Skip to content

Commit

Permalink
test(e2e): reorg upon API change
Browse files Browse the repository at this point in the history
  • Loading branch information
prometherion committed Aug 21, 2021
1 parent cf5c237 commit d03b0b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions e2e/tests/ingressclasses/delete.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ load "$BATS_TEST_DIRNAME/../../libs/serviceaccount_utils.bash"

setup() {
create_tenant ingressclassuser alice User
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/1", "value": {"kind": "ServiceAccount", "name": "system:serviceaccount:ingressclassuser-namespace:sa"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/2", "value": {"kind": "Group", "name": "foo.clastix.io"}}]'
create_namespace alice ingressclassuser-namespace
create_serviceaccount sa ingressclassuser-namespace

create_tenant ingressclassgroup foo.clastix.io Group
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom2"]}}]'
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom2"]}}}]'

if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -gt 17 ]]; then
local version="v1"
Expand Down Expand Up @@ -44,7 +44,7 @@ teardown() {
@test "Delete ingressClass without permissions" {
if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -lt 18 ]]; then
kubectl version
skip "IngressClass resources is not suported on Kubernetes < 1.18"
skip "IngressClass resources is not supported on Kubernetes < 1.18"
fi

echo "Delete ingressClass without List and Delete operations" >&3
Expand Down Expand Up @@ -72,7 +72,7 @@ teardown() {
@test "Delete ingressClass with List and Delete operations" {
if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -lt 18 ]]; then
kubectl version
skip "IngressClass resources is not suported on Kubernetes < 1.18"
skip "IngressClass resources is not supported on Kubernetes < 1.18"
fi

kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/0/proxySettings","value":[{"kind": "IngressClasses", "operations": ["List", "Delete"]}]}]'
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/ingressclasses/get.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ load "$BATS_TEST_DIRNAME/../../libs/serviceaccount_utils.bash"

setup() {
create_tenant ingressclassuser alice User
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/1", "value": {"kind": "ServiceAccount", "name": "system:serviceaccount:ingressclassuser-namespace:sa"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/2", "value": {"kind": "Group", "name": "foo.clastix.io"}}]'
create_namespace alice ingressclassuser-namespace
create_serviceaccount sa ingressclassuser-namespace

create_tenant ingressclassgroup foo.clastix.io Group
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom2"]}}]'
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom2"]}}}]'

if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -gt 17 ]]; then
local version="v1"
Expand Down Expand Up @@ -44,7 +44,7 @@ teardown() {
@test "Get ingressClass without permissions" {
if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -lt 18 ]]; then
kubectl version
skip "IngressClass resources is not suported on Kubernetes < 1.18"
skip "IngressClass resources is not supported on Kubernetes < 1.18"
fi

poll_until_equals "User" "" "kubectl --kubeconfig=${HACK_DIR}/alice.kubeconfig get ingressclasses.networking.k8s.io custom --output=name" 3 5
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/ingressclasses/list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ load "$BATS_TEST_DIRNAME/../../libs/serviceaccount_utils.bash"

setup() {
create_tenant ingressclassuser alice User
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/1", "value": {"kind": "ServiceAccount", "name": "system:serviceaccount:ingressclassuser-namespace:sa"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/2", "value": {"kind": "Group", "name": "foo.clastix.io"}}]'
create_namespace alice ingressclassuser-namespace
create_serviceaccount sa ingressclassuser-namespace

create_tenant ingressclassgroup foo.clastix.io Group
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom2"]}}]'
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom2"]}}}]'

if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -gt 17 ]]; then
local version="v1"
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ingressclasses/update.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ load "$BATS_TEST_DIRNAME/../../libs/serviceaccount_utils.bash"

setup() {
create_tenant ingressclassuser alice User
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom"], "allowedRegex": "\\w+-lb"}}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/1", "value": {"kind": "ServiceAccount", "name": "system:serviceaccount:ingressclassuser-namespace:sa"}}]'
kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/2", "value": {"kind": "Group", "name": "foo.clastix.io"}}]'
create_namespace alice ingressclassuser-namespace
create_serviceaccount sa ingressclassuser-namespace

create_tenant ingressclassgroup foo.clastix.io Group
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressClasses", "value": {"allowed": ["custom2"]}}]'
kubectl patch tenants.capsule.clastix.io ingressclassgroup --type=json -p '[{"op": "add", "path": "/spec/ingressOptions", "value": {"allowedClasses": {"allowed": ["custom2"]}}}]'

if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -gt 17 ]]; then
local version="v1"
Expand Down Expand Up @@ -44,7 +44,7 @@ teardown() {
@test "Update ingressClass without permissions" {
if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -lt 18 ]]; then
kubectl version
skip "IngressClass resources is not suported on Kubernetes < 1.18"
skip "IngressClass resources is not supported on Kubernetes < 1.18"
fi

echo "Update ingressClass without List and Update operations" >&3
Expand Down Expand Up @@ -72,7 +72,7 @@ teardown() {
@test "Update ingressClass with List and Update operations" {
if [[ $(kubectl version -o json | jq -r .serverVersion.minor) -lt 18 ]]; then
kubectl version
skip "IngressClass resources is not suported on Kubernetes < 1.18"
skip "IngressClass resources is not supported on Kubernetes < 1.18"
fi

kubectl patch tenants.capsule.clastix.io ingressclassuser --type=json -p '[{"op": "add", "path": "/spec/owners/0/proxySettings","value":[{"kind": "IngressClasses", "operations": ["List", "Update"]}]}]'
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/namespaces/list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ setup() {
create_tenant oil alice User
kubectl patch tenants.capsule.clastix.io oil --type=json -p '[{"op": "add", "path": "/spec/owners/1", "value": {"kind": "ServiceAccount", "name": "system:serviceaccount:oil-dev:sa"}}]'
kubectl patch tenants.capsule.clastix.io oil --type=json -p '[{"op": "add", "path": "/spec/owners/2", "value": {"kind": "Group", "name": "foo.clastix.io"}}]'
kubectl patch tenants.capsule.clastix.io oil --type=json -p '[{"op": "add", "path": "/spec/namespacesMetadata", "value": {"additionalLabels": {"bizz": "buzz"}}}]'
kubectl patch tenants.capsule.clastix.io oil --type=json -p '[{"op": "add", "path": "/spec/namespaceOptions", "value": {"additionalMetadata": {"labels": {"bizz": "buzz"}}}}]'
create_namespace alice oil-dev
create_namespace alice oil-staging
create_namespace alice oil-production
create_serviceaccount sa oil-dev

create_tenant metal alice User
kubectl patch tenants.capsule.clastix.io metal --type=json -p '[{"op": "add", "path": "/spec/namespacesMetadata", "value": {"additionalLabels": {"foo": "bar"}}}]'
kubectl patch tenants.capsule.clastix.io metal --type=json -p '[{"op": "add", "path": "/spec/namespaceOptions", "value": {"additionalMetadata": {"labels": {"foo": "bar"}}}}]'
create_namespace alice metal-staging

create_tenant gas foo.clastix.io Group
kubectl patch tenants.capsule.clastix.io gas --type=json -p '[{"op": "add", "path": "/spec/namespacesMetadata", "value": {"additionalLabels": {"bizz": "buzz"}}}]'
kubectl patch tenants.capsule.clastix.io gas --type=json -p '[{"op": "add", "path": "/spec/namespaceOptions", "value": {"additionalMetadata": {"labels": {"bizz": "buzz"}}}}]'
create_namespace joe gas-qa foo.clastix.io
}

Expand Down

0 comments on commit d03b0b9

Please sign in to comment.