Skip to content

Commit

Permalink
Make steveapi tests more flexible
Browse files Browse the repository at this point in the history
The steveapi integration tests try to be precise about the desired
output of API calls. This was causing a problem when run on k8s 1.23
which has default token secrets in every namespace and so was adding
extra resources to the response output. This change adds a label to the
secrets created in TestList so that they can easily be identified on a
live cluster and so unlabeled secrets can be ignored.
  • Loading branch information
cmurphy committed May 4, 2023
1 parent 52fb79f commit 5f78652
Show file tree
Hide file tree
Showing 82 changed files with 908 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-1/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-1",
"resourceVersion": "1000",
Expand All @@ -39,6 +42,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-2/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-2",
"resourceVersion": "1000",
Expand All @@ -61,6 +67,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-3/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-3",
"resourceVersion": "1000",
Expand All @@ -83,6 +92,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-4/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-4",
"resourceVersion": "1000",
Expand All @@ -105,6 +117,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-5/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-5",
"resourceVersion": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-1/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-1",
"resourceVersion": "1000",
Expand All @@ -40,7 +43,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-1",
Expand All @@ -65,7 +69,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-1",
Expand All @@ -90,7 +95,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-1",
Expand All @@ -115,7 +121,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-1",
Expand All @@ -44,7 +45,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-2",
Expand All @@ -69,7 +71,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-3",
Expand All @@ -94,7 +97,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-4",
Expand All @@ -119,7 +123,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-1",
Expand All @@ -144,7 +149,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-2",
Expand All @@ -163,7 +169,7 @@
"pages": 2,
"pagination": {
"first": "https://rancherurl/v1/secrets",
"next": "https://rancherurl/v1/secrets?continue=nondeterministictoken\u0026filter=metadata.labels.test-label-gte%3D3\u0026limit=20\u0026pagesize=6\u0026sort=-metadata.name",
"next": "https://rancherurl/v1/secrets?continue=nondeterministictoken\u0026filter=metadata.labels.test-label-gte%3D3\u0026labelSelector=test.cattle.io%2Fsteveapi%3Dtrue\u0026limit=20\u0026pagesize=6\u0026sort=-metadata.name",
"partial": true
},
"resourceType": "secret",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test5",
"namespace": "test-ns-5",
Expand All @@ -43,7 +44,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-5",
Expand All @@ -68,7 +70,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-3",
Expand All @@ -44,7 +45,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test4",
"namespace": "test-ns-4",
Expand All @@ -69,7 +71,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-1",
Expand All @@ -94,7 +97,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-2",
Expand All @@ -119,7 +123,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-3",
Expand All @@ -144,7 +149,8 @@
},
"metadata": {
"labels": {
"test-label-gte": "3"
"test-label-gte": "3",
"test.cattle.io/steveapi": "true"
},
"name": "test3",
"namespace": "test-ns-4",
Expand All @@ -163,7 +169,7 @@
"pages": 2,
"pagination": {
"first": "https://rancherurl/v1/secrets",
"next": "https://rancherurl/v1/secrets?continue=nondeterministictoken\u0026filter=metadata.labels.test-label-gte%3D3\u0026limit=20\u0026page=2\u0026pagesize=6\u0026revision=nondeterministicint\u0026sort=-metadata.name",
"next": "https://rancherurl/v1/secrets?continue=nondeterministictoken\u0026filter=metadata.labels.test-label-gte%3D3\u0026labelSelector=test.cattle.io%2Fsteveapi%3Dtrue\u0026limit=20\u0026page=2\u0026pagesize=6\u0026revision=nondeterministicint\u0026sort=-metadata.name",
"partial": true
},
"resourceType": "secret",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-1/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-1",
"resourceVersion": "1000",
Expand All @@ -39,6 +42,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-2/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-2",
"resourceVersion": "1000",
Expand All @@ -61,6 +67,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-3/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-3",
"resourceVersion": "1000",
Expand All @@ -83,6 +92,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-4/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-4",
"resourceVersion": "1000",
Expand All @@ -105,6 +117,9 @@
"view": "https://rancherurl/api/v1/namespaces/test-ns-5/secrets/test1"
},
"metadata": {
"labels": {
"test.cattle.io/steveapi": "true"
},
"name": "test1",
"namespace": "test-ns-5",
"resourceVersion": "1000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-1",
Expand All @@ -43,7 +44,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-2",
Expand All @@ -68,7 +70,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-3",
Expand All @@ -93,7 +96,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-4",
Expand All @@ -118,7 +122,8 @@
},
"metadata": {
"labels": {
"test-label": "2"
"test-label": "2",
"test.cattle.io/steveapi": "true"
},
"name": "test2",
"namespace": "test-ns-5",
Expand Down
Loading

0 comments on commit 5f78652

Please sign in to comment.