Skip to content

Commit

Permalink
Use different CRDs to allow test parallelism (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
lblackstone authored Apr 11, 2019
1 parent a33e855 commit f5b32da
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion tests/examples/python/python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestYaml(t *testing.T) {
assert.Equal(t, tokens.Type("kubernetes:apiextensions.k8s.io/v1beta1:CustomResourceDefinition"),
crd.URN.Type())
name, _ = openapi.Pluck(crd.Outputs, "metadata", "name")
assert.True(t, strings.HasPrefix(name.(string), "crontabs.stable.example.com"))
assert.True(t, strings.HasPrefix(name.(string), "foos.bar.example.com"))

// Verify namespace.
namespace := stackInfo.Deployment.Resources[1]
Expand Down
12 changes: 5 additions & 7 deletions tests/examples/python/yaml-test/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ items:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: crontabs.stable.example.com
name: foos.bar.example.com
spec:
group: stable.example.com
group: bar.example.com
versions:
- name: v1
served: true
storage: true
scope: Namespaced
names:
plural: crontabs
singular: crontab
kind: CronTab
shortNames:
- ct
plural: foos
singular: foo
kind: Foo
4 changes: 2 additions & 2 deletions tests/integration/crds/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func TestCRDs(t *testing.T) {
// Assert that CRD and CR exist
//

assert.Equal(t, "crontab", string(crd.URN.Name()))
assert.Equal(t, "my-new-cron-object", string(ct1.URN.Name()))
assert.Equal(t, "foobar", string(crd.URN.Name()))
assert.Equal(t, "my-new-foobar-object", string(ct1.URN.Name()))
},
EditDirs: []integration.EditDir{
{
Expand Down
20 changes: 10 additions & 10 deletions tests/integration/crds/step1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,30 @@ const namespace = new k8s.core.v1.Namespace("test-namespace");
// Create a CustomResourceDefinition and a CustomResource.
//

new k8s.apiextensions.v1beta1.CustomResourceDefinition("crontab", {
metadata: { name: "crontabs.stable.example.com" },
new k8s.apiextensions.v1beta1.CustomResourceDefinition("foobar", {
metadata: { name: "foobars.stable.example.com" },
spec: {
group: "stable.example.com",
version: "v1",
scope: "Namespaced",
names: {
plural: "crontabs",
singular: "crontab",
kind: "CronTab",
shortNames: ["ct"]
plural: "foobars",
singular: "foobar",
kind: "FooBar",
shortNames: ["fb"]
}
}
});

new k8s.apiextensions.CustomResource(
"my-new-cron-object",
"my-new-foobar-object",
{
apiVersion: "stable.example.com/v1",
kind: "CronTab",
kind: "FooBar",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-cron-object",
name: "my-new-foobar-object",
},
spec: { cronSpec: "* * * * */5", image: "my-awesome-cron-image" }
spec: { foo: "such amaze", bar: "wow" }
},
);
14 changes: 7 additions & 7 deletions tests/integration/crds/step2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const namespace = new k8s.core.v1.Namespace("test-namespace");
//

new k8s.apiextensions.CustomResource(
"my-new-cron-object",
"my-new-foobar-object",
{
apiVersion: "stable.example.com/v1",
kind: "CronTab",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-cron-object",
},
spec: { cronSpec: "* * * * */6", image: "my-awesome-cron-image" }
kind: "FooBar",
metadata: {
namespace: namespace.metadata.name,
name: "my-new-foobar-object",
},
spec: { foo: "such amaze" }
},
);

0 comments on commit f5b32da

Please sign in to comment.