Browse Source

Merge pull request #631 from external-secrets/feature/test-e2e

chore: test e2e
paul-the-alien[bot] 4 years ago
parent
commit
aa7b3ac33b

+ 1 - 3
e2e/framework/eso.go

@@ -26,20 +26,18 @@ import (
 	"k8s.io/apimachinery/pkg/util/wait"
 
 	esv1alpha1 "github.com/external-secrets/external-secrets/apis/externalsecrets/v1alpha1"
-	"github.com/external-secrets/external-secrets/e2e/framework/log"
 )
 
 // WaitForSecretValue waits until a secret comes into existence and compares the secret.Data
 // with the provided values.
 func (f *Framework) WaitForSecretValue(namespace, name string, expected *v1.Secret) (*v1.Secret, error) {
 	secret := &v1.Secret{}
-	err := wait.PollImmediate(time.Second*5, time.Minute, func() (bool, error) {
+	err := wait.PollImmediate(time.Second*10, time.Minute, func() (bool, error) {
 		err := f.CRClient.Get(context.Background(), types.NamespacedName{
 			Namespace: namespace,
 			Name:      name,
 		}, secret)
 		if apierrors.IsNotFound(err) {
-			log.Logf("Secret Not Found. Expected: %+v, Got: %+v", expected, secret)
 			return false, nil
 		}
 		return equalSecrets(expected, secret), nil

+ 4 - 0
e2e/framework/framework.go

@@ -79,6 +79,10 @@ func (f *Framework) BeforeEach() {
 // AfterEach deletes the namespace and cleans up the registered addons.
 func (f *Framework) AfterEach() {
 	for _, a := range f.Addons {
+		if CurrentSpecReport().Failed() {
+			err := a.Logs()
+			Expect(err).ToNot(HaveOccurred())
+		}
 		err := a.Uninstall()
 		Expect(err).ToNot(HaveOccurred())
 	}

+ 1 - 0
e2e/run.sh

@@ -52,6 +52,7 @@ kubectl run --rm \
   --env="GCP_SM_SA_JSON=${GCP_SM_SA_JSON:-}" \
   --env="GCP_PROJECT_ID=${GCP_PROJECT_ID:-}" \
   --env="GCP_GSA_NAME=${GCP_GSA_NAME:-}" \
+  --env="GCP_KSA_NAME=${GCP_KSA_NAME:-}" \
   --env="GCP_GKE_ZONE=${GCP_GKE_ZONE:-}" \
   --env="GCP_GKE_CLUSTER=${GCP_GKE_CLUSTER:-}" \
   --env="AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}" \

+ 3 - 3
terraform/gcp/eso_gcp_modules/network/main.tf

@@ -1,11 +1,11 @@
 resource "google_compute_network" "env-vpc" {
-  project = var.project_id
-  name          =  "${var.env}-vpc"
+  project                 = var.project_id
+  name                    = "${var.env}-vpc"
   auto_create_subnetworks = false
 }
 
 resource "google_compute_subnetwork" "env-subnet" {
-  project = var.project_id
+  project       = var.project_id
   name          = "${google_compute_network.env-vpc.name}-subnet"
   region        = var.region
   network       = google_compute_network.env-vpc.name

+ 16 - 16
terraform/gcp/main.tf

@@ -1,29 +1,29 @@
 terraform {
   backend "gcs" {
-    bucket = "eso-infra-state"
-    prefix = "eso-infra-state/state"
+    bucket      = "eso-infra-state"
+    prefix      = "eso-infra-state/state"
     credentials = "secrets/gcloud-service-account-key.json"
   }
 }
 
 module "test-network" {
-  source = "./eso_gcp_modules/network"
-  env = var.env
-  region = var.region
+  source        = "./eso_gcp_modules/network"
+  env           = var.env
+  region        = var.region
   ip_cidr_range = var.ip_cidr_range
-  project_id = var.project_id
+  project_id    = var.GCP_PROJECT_ID
 }
 
 module "test-cluster" {
-  source = "./eso_gcp_modules/gke"
-  project_id = var.project_id
-  env = var.env
-  region = var.region
-  network = module.test-network.vpc-object
-  subnetwork = module.test-network.subnet-name
-  node_count = var.node_count
+  source             = "./eso_gcp_modules/gke"
+  project_id         = var.GCP_PROJECT_ID
+  env                = var.env
+  region             = var.region
+  network            = module.test-network.vpc-object
+  subnetwork         = module.test-network.subnet-name
+  node_count         = var.node_count
   initial_node_count = var.initial_node_count
-  preemptible = true
-  GCP_GSA_NAME = var.GCP_GSA_NAME
-  GCP_KSA_NAME = var.GCP_KSA_NAME
+  preemptible        = true
+  GCP_GSA_NAME       = var.GCP_GSA_NAME
+  GCP_KSA_NAME       = var.GCP_KSA_NAME
 }

+ 0 - 1
terraform/gcp/variable.tf

@@ -1,7 +1,6 @@
 variable "env" { default = "test" }
 variable "region" { default = "europe-west1" }
 variable "zone" { default = "europe-west1-b" }
-variable "project_id" { default = "external-secrets-operator" }
 variable "horizontal_pod_autoscaling" { default = false }
 variable "node_count" { default = 2 }
 variable "node_min_count" { default = 2 }