Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance Tests for Cluster Peering #1287

Merged
merged 3 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS

- run-acceptance-tests:
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig" -enable-pod-security-policies -enable-transparent-proxy
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig" -enable-pod-security-policies

- store_test_results:
path: /tmp/test-results
Expand Down Expand Up @@ -701,7 +701,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS

- run-acceptance-tests:
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig" -enable-transparent-proxy
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig"

- store_test_results:
path: /tmp/test-results
Expand Down Expand Up @@ -762,7 +762,7 @@ jobs:
- run: mkdir -p $TEST_RESULTS

- run-acceptance-tests:
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig" -enable-transparent-proxy
additional-flags: -kubeconfig="$primary_kubeconfig" -secondary-kubeconfig="$secondary_kubeconfig"

- store_test_results:
path: /tmp/test-results
Expand Down Expand Up @@ -857,7 +857,7 @@ jobs:
- ~/.go_workspace/pkg/mod
- run: mkdir -p $TEST_RESULTS
- run-acceptance-tests:
additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2" -enable-transparent-proxy
additional-flags: -use-kind -kubecontext="kind-dc1" -secondary-kubecontext="kind-dc2"
- store_test_results:
path: /tmp/test-results
- store_artifacts:
Expand Down
10 changes: 10 additions & 0 deletions acceptance/tests/fixtures/bases/peering/peering-acceptor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: PeeringAcceptor
metadata:
name: server
spec:
peer:
secret:
name: "api-token"
key: "data"
backend: "kubernetes"
10 changes: 10 additions & 0 deletions acceptance/tests/fixtures/bases/peering/peering-dialer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: PeeringDialer
metadata:
name: client
spec:
peer:
secret:
name: "api-token"
key: "data"
backend: "kubernetes"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- ../../../bases/exportedservices-default

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
name: default
spec:
services:
- name: static-server
namespace: default
consumers:
- peer: client
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- ../../../bases/exportedservices-default

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
name: default
spec:
services:
- name: static-server
namespace: ns1
consumers:
- peer: client
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- ../../../bases/static-client

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: static-client
spec:
template:
metadata:
annotations:
"consul.hashicorp.com/connect-inject": "true"
"consul.hashicorp.com/connect-service-upstreams": "static-server.svc.default.ns.server.peer:1234"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- ../../../bases/static-client

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: static-client
spec:
template:
metadata:
annotations:
"consul.hashicorp.com/connect-inject": "true"
"consul.hashicorp.com/connect-service-upstreams": "static-server.svc.ns1.ns.server.peer:1234"
22 changes: 22 additions & 0 deletions acceptance/tests/peering/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package peering

import (
"fmt"
"os"
"testing"

testsuite "github.com/hashicorp/consul-k8s/acceptance/framework/suite"
)

var suite testsuite.Suite

func TestMain(m *testing.M) {
suite = testsuite.NewSuite(m)

if suite.Config().EnableMultiCluster {
os.Exit(suite.Run())
} else {
fmt.Println("Skipping peering tests because -enable-multi-cluster is not set")
os.Exit(0)
}
}
Loading