Skip to content

Commit

Permalink
Move use cases to e2e/testdata directory
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Zanini <[email protected]>
  • Loading branch information
ricardozanini committed Oct 3, 2024
1 parent 0cfd3f1 commit d56e3b5
Show file tree
Hide file tree
Showing 88 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.e2e.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pipeline {
helper.checkoutRepo()

assert getTestImage(): 'Please provide a Test image'
container.pullImage(getTestImage()) // Verify image exists
container.pullImage(getTestImage()) // Verify image namespaceExists
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ vet: ## Run go vet against code.

.PHONY: test
test: manifests generate envtest test-api ## Run tests.
@$(MAKE) addheaders
@$(MAKE) vet
@$(MAKE) fmt
@echo "🔍 Running controller tests..."
@KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" \
go test $(shell go list ./... | grep -v /test/) -coverprofile cover.out > /dev/null 2>&1
Expand Down Expand Up @@ -400,7 +403,7 @@ generate-all: generate generate-deploy bundle

.PHONY: test-e2e # You will need to have a Minikube/Kind cluster up and running to run this target, and run container-builder before the test
label = "flows-ephemeral" # possible values are flows-ephemeral, flows-persistence, platform, cluster
test-e2e: kustomize
test-e2e:
ifeq ($(label), cluster)
@echo "🌐 Running e2e tests for cluster..."
go test ./test/e2e/e2e_suite_test.go ./test/e2e/helpers.go ./test/e2e/clusterplatform_test.go \
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha08/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions api/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion container-builder/api/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
// Run e2e tests using the Ginkgo runner.
func TestE2E(t *testing.T) {
RegisterFailHandler(Fail)
_, _ = fmt.Fprintf(GinkgoWriter, "Starting SonataFlow Operator suite\n")
GinkgoWriter.Println("Starting SonataFlow Operator suite")
RunSpecs(t, "SonataFlow Operator e2e suite")
}

Expand Down Expand Up @@ -83,14 +83,14 @@ type DeployedWorkflow struct {

var _ = BeforeSuite(func() {
GinkgoWriter.Print("Checking if resources namespace is available\n")
exists, err := kubectlNamespaceExists(resourcesNamespace)
namespaceExists, err := kubectlNamespaceExists(resourcesNamespace)
Expect(err).NotTo(HaveOccurred())

workflows := make(map[string]*DeployedWorkflow, 2)
workflows[flowCallbackName] = &DeployedWorkflow{YAMLFile: test.GetPathFromE2EDirectory("before-suite", "sonataflow.org_v1alpha08_sonataflow-callbackstatetimeouts.yaml")}
workflows[flowCallbackPersistenceName] = &DeployedWorkflow{YAMLFile: test.GetPathFromE2EDirectory("before-suite", "sonataflow.org_v1alpha08_sonataflow-callbackstatetimeouts-persistence.yaml")}
workflows[flowGreetingsName] = &DeployedWorkflow{YAMLFile: test.GetPathFromE2EDirectory("before-suite", "sonataflow.org_v1alpha08_sonataflow-greetings.yaml")}
if !exists {
if !namespaceExists {
GinkgoWriter.Println("Creating the resources namespace")
err = kubectlCreateNamespace(resourcesNamespace)
Expect(err).NotTo(HaveOccurred())
Expand Down
2 changes: 1 addition & 1 deletion test/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func GetPathFromDataDirectory(join ...string) string {
}

func GetPathFromE2EDirectory(join ...string) string {
return filepath.Join(append([]string{getTestDataDir(), "e2e"}, join...)...)
return filepath.Join(append([]string{getProjectDir(), "test", "e2e", "testdata"}, join...)...)
}

// getTestDataDir gets the testdata directory containing every sample out there from test/testdata.
Expand Down

0 comments on commit d56e3b5

Please sign in to comment.