Skip to content

Commit

Permalink
Merge pull request #116 from turkenh/reuse-uptest-workflow
Browse files Browse the repository at this point in the history
Reuse Uptest workflow and standardize Makefile targets
  • Loading branch information
turkenh committed Nov 8, 2022
2 parents 2075570 + 6218917 commit 334b267
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 387 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: End to End Testing

on:
issue_comment:
types: [created]

jobs:
e2e:
uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@main
secrets:
UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }}
UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }}
186 changes: 0 additions & 186 deletions .github/workflows/uptest.yml

This file was deleted.

45 changes: 26 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,34 @@ pull-docs:

generate.init: $(TERRAFORM_PROVIDER_SCHEMA) pull-docs

# ====================================================================================
# Test utilities
# TODO(muvaf): Move most of this to build submodule.

uptest: $(KIND) $(KUBECTL) $(HELM3) $(UP) $(KUTTL) $(UPTEST)
@$(INFO) running uptest using kind $(KIND_VERSION)
@./cluster/install_provider.sh || $(FAIL)
@echo "$${UPTEST_EXAMPLE_VALUE_REPLACEMENTS}" > $(WORK_DIR)/replacements.yaml
@KIND=$(KIND) KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${EXAMPLE_LIST}" --default-conditions="Test" --test-directory="${DUMP_DIRECTORY}" --data-source "$(WORK_DIR)/replacements.yaml" || $(FAIL)

uptest-local: $(KUBECTL) $(KUTTL) $(UPTEST)
@$(INFO) running automated tests with uptest using current kubeconfig $(KIND_VERSION)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${EXAMPLE_LIST}" --default-conditions="Test" --data-source "$(WORK_DIR)/replacements.yaml" || $(FAIL)

cluster_dump: $(KUBECTL)
@mkdir -p ${DUMP_DIRECTORY}
@$(KUBECTL) cluster-info dump --output-directory ${DUMP_DIRECTORY} --all-namespaces || true
@$(KUBECTL) get managed -o yaml > ${DUMP_DIRECTORY}/managed.yaml || true

.PHONY: pull-docs

# ====================================================================================
# End to End Testing
CROSSPLANE_NAMESPACE = upbound-system
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

# This target requires the following environment variables to be set:
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials)
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# - UPTEST_DATASOURCE_PATH, see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --setup-script=cluster/test/setup.sh || $(FAIL)
@$(OK) running automated tests

uptest-local:
@$(WARN) "this target is deprecated, please use 'make uptest' instead"

# This target requires the following environment variables to be set:
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials)
# - UPTEST_EXAMPLE_LIST, a comma-separated list of examples to test
# - UPTEST_DATASOURCE_PATH, see https://github.com/upbound/uptest#injecting-dynamic-values-and-datasource
e2e: build controlplane.up local.xpkg.deploy.provider.$(PROJECT_NAME) uptest

.PHONY: uptest e2e

# ====================================================================================
# Special Targets

Expand Down
2 changes: 1 addition & 1 deletion build
Loading

0 comments on commit 334b267

Please sign in to comment.