Skip to content

Commit

Permalink
Add acceptance tests that run connect tests for peering.
Browse files Browse the repository at this point in the history
- Does not support TLS, ACLs and T-Proxy.
  • Loading branch information
thisisnotashwin committed Jun 21, 2022
1 parent 2d2ab95 commit 339816b
Show file tree
Hide file tree
Showing 14 changed files with 438 additions and 7 deletions.
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

0 comments on commit 339816b

Please sign in to comment.