Skip to content

Commit

Permalink
Add prefix factory option (#1695)
Browse files Browse the repository at this point in the history
* Add prefix factory option

This allows us to re-use existing clusters and can greatly fasten
the testing time.
  • Loading branch information
flowguru authored Jun 25, 2023
1 parent f67bbba commit b03e228
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ compile:
TIMEOUT?=168h

NAMESPACE?=
PREFIX?=
CONTEXT?=
FDB_VERSION?=7.1.31
PREVIOUS_FDB_VERSION?=6.3.25
Expand Down Expand Up @@ -108,6 +109,7 @@ nightly-tests: run
--ginkgo.timeout=$(TIMEOUT) \
--timeout=$(TIMEOUT) \
--namespace="$(NAMESPACE)" \
--prefix="$(PREFIX)" \
--context="$(CONTEXT)" \
--fdb-image="$(FDB_IMAGE)" \
--sidecar-image="$(SIDECAR_IMAGE)" \
Expand Down
7 changes: 5 additions & 2 deletions e2e/fixtures/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,12 @@ func (factory *Factory) getContainerOverrides(
return mainOverrides, sidecarOverrides
}

// getClusterPrefix returns the cluster name prefix.
func (factory *Factory) getClusterPrefix() string {
return fmt.Sprintf("fdb-cluster-%s", RandStringRunes(8))
prefix := factory.options.prefix
if prefix == "" {
return fmt.Sprintf("fdb-cluster-%s", RandStringRunes(8))
}
return prefix
}

// GetDefaultStorageClass returns either the StorageClass provided by the command line or fetches the StorageClass passed on
Expand Down
7 changes: 7 additions & 0 deletions e2e/fixtures/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
type FactoryOptions struct {
namespace string
chaosNamespace string
prefix string
context string
fdbImage string // TODO (johscheuer): Make this optional if we use the default
sidecarImage string // TODO (johscheuer): Make this optional if we use the default
Expand Down Expand Up @@ -65,6 +66,12 @@ func (options *FactoryOptions) BindFlags(fs *flag.FlagSet) {
"",
"defines the chaos namespace to run experiments (will be created if missing)",
)
fs.StringVar(
&options.prefix,
"prefix",
"",
"defines the prefix of fdb cluster to run the test (will be created if missing)",
)
fs.StringVar(
&options.context,
"context",
Expand Down

0 comments on commit b03e228

Please sign in to comment.