Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
RothAndrew committed Mar 21, 2022
1 parent d0f94eb commit aeee554
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ package-example-compose:

# TODO: This can be cleaned up a little more when `zarf init` is able to provide the path to the `zarf-init-<arch>.tar.zst`
.PHONY: test-e2e
test-e2e: ## Run e2e tests. Will automatically build any required dependencies that aren't present
test-e2e: ## Run e2e tests. Will automatically build any required dependencies that aren't present. Requires env var TESTDISTRO=[provided|kind|k3d|k3s]
@#Check to make sure all the packages we need exist
@if [ ! -f $(ZARF_BIN) ]; then\
$(MAKE) build-cli;\
Expand Down
17 changes: 9 additions & 8 deletions test/e2e/clusters/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ import (
kindcmd "sigs.k8s.io/kind/pkg/cmd"
)

// DistroToUse is an "enum" for helping determine which k8s distro to run the tests on
// DistroToUse is an "enum" for helping determine which k8s distro to run the tests on.
type DistroToUse int

const (
// DistroUnknown is the "enum" representation for when we don't know what distro the user wants
// DistroUnknown is the "enum" representation for when we don't know what distro the user wants.
DistroUnknown DistroToUse = iota
// DistroProvided is the "enum" representation for when the user wants to use the k8s cluster that is already present
// DistroProvided is the "enum" representation for when the user wants to use the k8s cluster that is already present.
DistroProvided
// DistroKind is the "enum" representation for when the user wants the test suite to set up its own KinD cluster
// DistroKind is the "enum" representation for when the user wants the test suite to set up its own KinD cluster.
DistroKind
// DistroK3d is the "enum" representation for when the user wants the test suite to set up its own K3d cluster
// DistroK3d is the "enum" representation for when the user wants the test suite to set up its own K3d cluster.
DistroK3d
// DistroK3s is the "enum" representation for when the user wants the test suite to use Zarf's built-in K3s cluster
// DistroK3s is the "enum" representation for when the user wants the test suite to use Zarf's built-in K3s cluster.
DistroK3s

kindClusterName = "kind-zarf-test"
k3dClusterName = "k3d-zarf-test"
)

// GetDistroToUseFromString decides which cluster the user wants based on the string value passed from an environment
// variable
// variable.
func GetDistroToUseFromString(s string) (DistroToUse, error) {
match := map[string]DistroToUse{
"provided": DistroProvided,
Expand Down Expand Up @@ -220,7 +220,7 @@ func createK3dClusterUsingCurrentKubeconfig() error {
}

// deleteK3dCluster deletes the K3d cluster that was created at the beginning of the test suite. It uses the currently
// configured Kubeconfig file (from the KUBECONFIG env var)
// configured Kubeconfig file (from the KUBECONFIG env var).
func deleteK3dCluster() error {
deleteClusterCommand := k3dCluster.NewCmdClusterDelete()
deleteClusterCommand.SetArgs([]string{
Expand All @@ -230,6 +230,7 @@ func deleteK3dCluster() error {
if err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit aeee554

Please sign in to comment.