1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

chore: test e2e

Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
This commit is contained in:
Moritz Johner 2022-01-24 15:03:15 +01:00
parent c14c0ac930
commit ea5689a945
6 changed files with 25 additions and 23 deletions

View file

@ -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

View file

@ -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())
}

View file

@ -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:-}" \

View file

@ -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

View file

@ -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
}

View file

@ -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 }