From d349210d79a37e97cbf9a0991cd05c37d45c77c4 Mon Sep 17 00:00:00 2001 From: Pablo Chacin Date: Fri, 21 Jul 2023 15:07:09 +0200 Subject: [PATCH] Use Etcd RAM disk in e2e tests Signed-off-by: Pablo Chacin --- pkg/testutils/e2e/cluster/cluster.go | 29 +++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/pkg/testutils/e2e/cluster/cluster.go b/pkg/testutils/e2e/cluster/cluster.go index a7cf002b..ec745386 100644 --- a/pkg/testutils/e2e/cluster/cluster.go +++ b/pkg/testutils/e2e/cluster/cluster.go @@ -21,15 +21,16 @@ type PostInstall func(ctx context.Context, cluster E2eCluster) error // E2eClusterConfig defines the configuration of a e2e test cluster type E2eClusterConfig struct { - Name string - Images []string - IngressAddr string - IngressPort int32 - PostInstall []PostInstall - Reuse bool - Wait time.Duration - AutoCleanup bool - Kubeconfig string + Name string + Images []string + IngressAddr string + IngressPort int32 + PostInstall []PostInstall + Reuse bool + Wait time.Duration + AutoCleanup bool + Kubeconfig string + UseEtcdRAMDisk bool } // E2eCluster defines the interface for accessing an e2e cluster @@ -116,6 +117,7 @@ func DefaultE2eClusterConfig() E2eClusterConfig { PostInstall: []PostInstall{ InstallContourIngress, }, + UseEtcdRAMDisk: true, } } @@ -178,6 +180,14 @@ func WithReuse(reuse bool) E2eClusterOption { } } +// WithEtcdRAMDisk specifies if the cluster must be configured to use a RAM disk for Etcd +func WithEtcdRAMDisk(ramdisk bool) E2eClusterOption { + return func(c E2eClusterConfig) (E2eClusterConfig, error) { + c.UseEtcdRAMDisk = ramdisk + return c, nil + } +} + // e2eCluster maintains the status of a cluster type e2eCluster struct { cluster *cluster.Cluster @@ -236,6 +246,7 @@ func createE2eCluster(e2eConfig E2eClusterConfig) (*e2eCluster, error) { func mergeEnvVariables(config E2eClusterConfig) E2eClusterConfig { config.AutoCleanup = utils.GetBooleanEnvVar("E2E_AUTOCLEANUP", config.AutoCleanup) config.Reuse = utils.GetBooleanEnvVar("E2E_REUSE", config.Reuse) + config.UseEtcdRAMDisk = utils.GetBooleanEnvVar("E2E_ETCD_RAMDISK", config.UseEtcdRAMDisk) return config }