Skip to content

Commit

Permalink
feat(bootstrap): use the kubernetes.Cluster for Corefile template sce…
Browse files Browse the repository at this point in the history
…nario

Signed-off-by: Jay Chen <[email protected]>
  • Loading branch information
jijiechen committed Dec 22, 2023
1 parent 84070af commit 70e7b3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 7 additions & 14 deletions test/e2e_env/kubernetes/bootstrap/corefile_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package bootstrap

import (
"fmt"

Check failure on line 4 in test/e2e_env/kubernetes/bootstrap/corefile_template.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/kumahq/kuma) --custom-order (gci)
"strings"
"time"

"github.com/gruntwork-io/terratest/modules/random"
"github.com/kumahq/kuma/test/framework/envs/kubernetes"

Check failure on line 6 in test/e2e_env/kubernetes/bootstrap/corefile_template.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/kumahq/kuma) --custom-order (gci)
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"strings"

Check failure on line 9 in test/e2e_env/kubernetes/bootstrap/corefile_template.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/kumahq/kuma) --custom-order (gci)

"github.com/kumahq/kuma/pkg/config/core"
k8s_util "github.com/kumahq/kuma/pkg/plugins/runtime/k8s/util"
Expand All @@ -16,7 +15,6 @@ import (
)

func CorefileTemplate() {
var zoneCluster Cluster
appNamespace := "dns-app"
appName := "demo-dp-app"
expectedTestText := "# this dummy corefile template is loaded from control plane"
Expand All @@ -37,12 +35,7 @@ data:

dnsConfigDir := "/tmp/kuma-dp-config/coredns"
BeforeAll(func() {
zoneCluster = NewK8sCluster(NewTestingT(), Kuma2, Silent).
WithTimeout(6 * time.Second).
WithRetries(60)

Expect(NewClusterSetup().
Install(Namespace(Config.KumaNamespace)).
Install(YamlK8s(configMap(Config.KumaNamespace))).
Install(Kuma(core.Zone,
WithInstallationMode(HelmInstallationMode),
Expand All @@ -62,20 +55,20 @@ data:
"kuma.io/sidecar-env-vars": fmt.Sprintf("KUMA_DNS_CONFIG_DIR=%s", dnsConfigDir),
}),
)).
Setup(zoneCluster),
Setup(kubernetes.Cluster),
).To(Succeed())
})

E2EAfterAll(func() {
Expect(zoneCluster.DeleteKuma()).To(Succeed())
Expect(zoneCluster.DismissCluster()).To(Succeed())
Expect(kubernetes.Cluster.DeleteKuma()).To(Succeed())
Expect(kubernetes.Cluster.DismissCluster()).To(Succeed())
})

It("should use Corefile template from control plane at data plane", func() {
dpPod, err := PodNameOfApp(zoneCluster, appName, appNamespace)
dpPod, err := PodNameOfApp(kubernetes.Cluster, appName, appNamespace)
Expect(err).ToNot(HaveOccurred())

stdout, stderr, err := zoneCluster.Exec(
stdout, stderr, err := kubernetes.Cluster.Exec(
appNamespace, dpPod, k8s_util.KumaSidecarContainerName, "cat", dnsConfigDir+"/Corefile")
Expect(err).ToNot(HaveOccurred())
Expect(stderr).To(BeEmpty())
Expand Down
2 changes: 1 addition & 1 deletion test/e2e_env/kubernetes/kubernetes_suite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kubernetes_test

import (

Check failure on line 3 in test/e2e_env/kubernetes/kubernetes_suite_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
"github.com/kumahq/kuma/test/e2e_env/kubernetes/externalservices"
"testing"

Check failure on line 5 in test/e2e_env/kubernetes/kubernetes_suite_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)

. "github.com/onsi/ginkgo/v2"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/kumahq/kuma/test/e2e_env/kubernetes/container_patch"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/defaults"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/externalname-services"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/externalservices"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/gateway"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/graceful"
"github.com/kumahq/kuma/test/e2e_env/kubernetes/healthcheck"
Expand Down

0 comments on commit 70e7b3f

Please sign in to comment.