diff --git a/.goreleaser.yml b/.goreleaser.yml index 0df6742e..50427c32 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,7 +13,7 @@ builds: binary: kubectl-kuttl main: cmd/kubectl-kuttl/main.go ldflags: - - -s -w -X github.com/kudobuilder/kuttl/pkg/version.gitVersion={{ .Version }} -X github.com/kudobuilder/kuttl/pkg/version.gitCommit={{ .ShortCommit }} -X github.com/kudobuilder/kuttl/pkg/version.buildDate={{ .Date }} + - -s -w -X github.com/kudobuilder/kuttl/internal/version.gitVersion={{ .Version }} -X github.com/kudobuilder/kuttl/internal/version.gitCommit={{ .ShortCommit }} -X github.com/kudobuilder/kuttl/internal/version.buildDate={{ .Date }} goos: - linux - darwin diff --git a/Makefile b/Makefile index 7254f413..a535e864 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ SHELL=/bin/bash -o pipefail CLI := kubectl-kuttl -GIT_VERSION_PATH := github.com/kudobuilder/kuttl/pkg/version.gitVersion +GIT_VERSION_PATH := github.com/kudobuilder/kuttl/internal/version.gitVersion GIT_VERSION := $(shell git describe --abbrev=0 --tags | cut -b 2-) -GIT_COMMIT_PATH := github.com/kudobuilder/kuttl/pkg/version.gitCommit +GIT_COMMIT_PATH := github.com/kudobuilder/kuttl/internal/version.gitCommit GIT_COMMIT := $(shell git rev-parse HEAD | cut -b -8) SOURCE_DATE_EPOCH := $(shell git show -s --format=format:%ct HEAD) -BUILD_DATE_PATH := github.com/kudobuilder/kuttl/pkg/version.buildDate +BUILD_DATE_PATH := github.com/kudobuilder/kuttl/internal/version.buildDate DATE_FMT := "%Y-%m-%dT%H:%M:%SZ" BUILD_DATE := $(shell date -u -d "@$SOURCE_DATE_EPOCH" "+${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "+${DATE_FMT}" 2>/dev/null || date -u "+${DATE_FMT}") LDFLAGS := -X ${GIT_VERSION_PATH}=${GIT_VERSION} -X ${GIT_COMMIT_PATH}=${GIT_COMMIT} -X ${BUILD_DATE_PATH}=${BUILD_DATE} @@ -131,9 +131,9 @@ all: lint test integration-test e2e-test ## Runs lint, unit, integration and e2 test: ## Runs unit tests ifdef _INTELLIJ_FORCE_SET_GOFLAGS # Run tests from a Goland terminal. Goland already set '-mod=readonly' - go test ./pkg/... -v -coverprofile cover.out + go test ./pkg/... ./internal/... -v -coverprofile cover.out else - go test ./pkg/... -v -mod=readonly -coverprofile cover.out + go test ./pkg/... ./internal/... -v -mod=readonly -coverprofile cover.out endif .PHONY: integration-test diff --git a/cmd/kubectl-kuttl/main.go b/cmd/kubectl-kuttl/main.go index 80d33b90..31a18c7c 100644 --- a/cmd/kubectl-kuttl/main.go +++ b/cmd/kubectl-kuttl/main.go @@ -17,7 +17,7 @@ package main import ( "os" - "github.com/kudobuilder/kuttl/pkg/kuttlctl/cmd" + "github.com/kudobuilder/kuttl/internal/kuttlctl/cmd" ) func main() { diff --git a/docs/api-integration.md b/docs/api-integration.md index 90655530..c00a4599 100644 --- a/docs/api-integration.md +++ b/docs/api-integration.md @@ -16,13 +16,10 @@ The test harness type is defined in an `apis` package similar to a Kubernetes ty The `test` package contains the `test.Harness` implementation (given the configuration of the test harness configuration type previously mentioned). The `test.Harness` provides the "run" of the test run and needs a Go `t *testing.T`. -The `testutils` package contains utilities for docker, kubernetes, loggers and testing. - ```go import ( harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" "github.com/kudobuilder/kuttl/pkg/test" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) ``` @@ -37,16 +34,13 @@ options := harness.TestSuite{} The Go `t *testing.T` and `harness.TestSuite` are provided to `test.Harness` which provides the implementation for testing. ```go -Run: func(cmd *cobra.Command, args []string) { - testutils.RunTests("kudo", testToRun, options.Parallel, func(t *testing.T) { +func TestWithKuttl(t *testing.T) { harness := test.Harness{ TestSuite: options, T: t, } - harness.Run() - }) -}, +} ``` diff --git a/docs/cli.md b/docs/cli.md index 02710ea0..86958509 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -137,7 +137,7 @@ parallel: 4 The default can be run as follows: ```bash -kubectl kuttl test pkg/test/test_data/ +kubectl kuttl test internal/harness/test_data/ ``` When running with no defined [test environment](testing/test-environments.md), the default is a preconfigured cluster defined in `$KUBECONFIG`. @@ -145,11 +145,11 @@ When running with no defined [test environment](testing/test-environments.md), t To run with the mocked control plane run: ```bash -kubectl kuttl test --start-control-plane pkg/test/test_data/ +kubectl kuttl test --start-control-plane internal/harness/test_data/ ``` In order to run with the full kind cluster stack, run: ```bash -kubectl kuttl test --start-kind pkg/test/test_data/ +kubectl kuttl test --start-kind internal/harness/test_data/ ``` diff --git a/hack/run-integration-tests.sh b/hack/run-integration-tests.sh index 7095548f..5ae43788 100755 --- a/hack/run-integration-tests.sh +++ b/hack/run-integration-tests.sh @@ -14,8 +14,8 @@ then go get github.com/jstemmer/go-junit-report go install github.com/jstemmer/go-junit-report go mod tidy - go test -tags integration ./pkg/... -v -mod=readonly -coverprofile cover-integration.out 2>&1 |tee /dev/fd/2 |go-junit-report -set-exit-code > reports/integration_report.xml + go test -tags integration ./pkg/... ./internal/... -v -mod=readonly -coverprofile cover-integration.out 2>&1 |tee /dev/fd/2 |go-junit-report -set-exit-code > reports/integration_report.xml else echo "Running integration tests without junit output" - go test -tags integration ./pkg/... -v -mod=readonly -coverprofile cover-integration.out + go test -tags integration ./pkg/... ./internal/... -v -mod=readonly -coverprofile cover-integration.out fi diff --git a/pkg/test/assert/assert.go b/internal/assert/assert.go similarity index 96% rename from pkg/test/assert/assert.go rename to internal/assert/assert.go index fa55943d..e1fc5bfb 100644 --- a/pkg/test/assert/assert.go +++ b/internal/assert/assert.go @@ -8,8 +8,8 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/test/step" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/step" ) // Assert checks all provided assert files against a namespace. Upon assert failure, it prints the failures and returns an error diff --git a/pkg/env/env.go b/internal/env/env.go similarity index 100% rename from pkg/env/env.go rename to internal/env/env.go diff --git a/pkg/env/env_test.go b/internal/env/env_test.go similarity index 100% rename from pkg/env/env_test.go rename to internal/env/env_test.go diff --git a/pkg/expressions/cel.go b/internal/expressions/cel.go similarity index 100% rename from pkg/expressions/cel.go rename to internal/expressions/cel.go diff --git a/pkg/file/files.go b/internal/file/files.go similarity index 96% rename from pkg/file/files.go rename to internal/file/files.go index 9dabeb5b..f1d206a3 100644 --- a/pkg/file/files.go +++ b/internal/file/files.go @@ -8,7 +8,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kudobuilder/kuttl/pkg/kubernetes" + "github.com/kudobuilder/kuttl/internal/kubernetes" ) // from a list of paths, returns an array of runtime objects diff --git a/pkg/file/files_test.go b/internal/file/files_test.go similarity index 100% rename from pkg/file/files_test.go rename to internal/file/files_test.go diff --git a/pkg/file/tar.go b/internal/file/tar.go similarity index 100% rename from pkg/file/tar.go rename to internal/file/tar.go diff --git a/pkg/file/tar_test.go b/internal/file/tar_test.go similarity index 100% rename from pkg/file/tar_test.go rename to internal/file/tar_test.go diff --git a/pkg/file/testdata/path/missing/readme.txt b/internal/file/testdata/path/missing/readme.txt similarity index 100% rename from pkg/file/testdata/path/missing/readme.txt rename to internal/file/testdata/path/missing/readme.txt diff --git a/pkg/file/testdata/path/skip.txt b/internal/file/testdata/path/skip.txt similarity index 100% rename from pkg/file/testdata/path/skip.txt rename to internal/file/testdata/path/skip.txt diff --git a/pkg/file/testdata/path/test1.yaml b/internal/file/testdata/path/test1.yaml similarity index 100% rename from pkg/file/testdata/path/test1.yaml rename to internal/file/testdata/path/test1.yaml diff --git a/pkg/file/testdata/path/test2.yaml b/internal/file/testdata/path/test2.yaml similarity index 100% rename from pkg/file/testdata/path/test2.yaml rename to internal/file/testdata/path/test2.yaml diff --git a/pkg/file/testdata/tar-test.tgz b/internal/file/testdata/tar-test.tgz similarity index 100% rename from pkg/file/testdata/tar-test.tgz rename to internal/file/testdata/tar-test.tgz diff --git a/pkg/test/harness/harness.go b/internal/harness/harness.go similarity index 98% rename from pkg/test/harness/harness.go rename to internal/harness/harness.go index 6abffdfd..0973e213 100644 --- a/pkg/test/harness/harness.go +++ b/internal/harness/harness.go @@ -26,14 +26,14 @@ import ( "sigs.k8s.io/controller-runtime/pkg/envtest" kindConfig "sigs.k8s.io/kind/pkg/apis/config/v1alpha4" + "github.com/kudobuilder/kuttl/internal/file" + "github.com/kudobuilder/kuttl/internal/http" + "github.com/kudobuilder/kuttl/internal/kind" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/report" + "github.com/kudobuilder/kuttl/internal/testcase" + testutils "github.com/kudobuilder/kuttl/internal/utils" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/file" - "github.com/kudobuilder/kuttl/pkg/http" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/report" - "github.com/kudobuilder/kuttl/pkg/test/kind" - "github.com/kudobuilder/kuttl/pkg/test/testcase" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) // Harness loads and runs tests based on the configuration provided. diff --git a/pkg/test/harness/harness_integration_test.go b/internal/harness/harness_integration_test.go similarity index 97% rename from pkg/test/harness/harness_integration_test.go rename to internal/harness/harness_integration_test.go index 80725f3a..2b3aa228 100644 --- a/pkg/test/harness/harness_integration_test.go +++ b/internal/harness/harness_integration_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/assert" + "github.com/kudobuilder/kuttl/internal/kubernetes" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" ) func TestHarnessRunIntegration(t *testing.T) { diff --git a/pkg/test/harness/harness_test.go b/internal/harness/harness_test.go similarity index 100% rename from pkg/test/harness/harness_test.go rename to internal/harness/harness_test.go diff --git a/pkg/test/harness/test_crds/ourcrds.yaml b/internal/harness/test_crds/ourcrds.yaml similarity index 100% rename from pkg/test/harness/test_crds/ourcrds.yaml rename to internal/harness/test_crds/ourcrds.yaml diff --git a/pkg/test/harness/test_data/cli-test/00-assert.yaml b/internal/harness/test_data/cli-test/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/cli-test/00-assert.yaml rename to internal/harness/test_data/cli-test/00-assert.yaml diff --git a/pkg/test/harness/test_data/cli-test/00-create-pod.yaml b/internal/harness/test_data/cli-test/00-create-pod.yaml similarity index 100% rename from pkg/test/harness/test_data/cli-test/00-create-pod.yaml rename to internal/harness/test_data/cli-test/00-create-pod.yaml diff --git a/pkg/test/harness/test_data/cli-test/01-assert.yaml b/internal/harness/test_data/cli-test/01-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/cli-test/01-assert.yaml rename to internal/harness/test_data/cli-test/01-assert.yaml diff --git a/pkg/test/harness/test_data/cli-test/01-patch.yaml b/internal/harness/test_data/cli-test/01-patch.yaml similarity index 100% rename from pkg/test/harness/test_data/cli-test/01-patch.yaml rename to internal/harness/test_data/cli-test/01-patch.yaml diff --git a/pkg/test/harness/test_data/cli-test/test_data/pod.yaml b/internal/harness/test_data/cli-test/test_data/pod.yaml similarity index 100% rename from pkg/test/harness/test_data/cli-test/test_data/pod.yaml rename to internal/harness/test_data/cli-test/test_data/pod.yaml diff --git a/pkg/test/harness/test_data/crd-in-step/00-assert.yaml b/internal/harness/test_data/crd-in-step/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/crd-in-step/00-assert.yaml rename to internal/harness/test_data/crd-in-step/00-assert.yaml diff --git a/pkg/test/harness/test_data/crd-in-step/00-crd.yaml b/internal/harness/test_data/crd-in-step/00-crd.yaml similarity index 100% rename from pkg/test/harness/test_data/crd-in-step/00-crd.yaml rename to internal/harness/test_data/crd-in-step/00-crd.yaml diff --git a/pkg/test/harness/test_data/crd-in-step/01-assert.yaml b/internal/harness/test_data/crd-in-step/01-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/crd-in-step/01-assert.yaml rename to internal/harness/test_data/crd-in-step/01-assert.yaml diff --git a/pkg/test/harness/test_data/crd-in-step/01-create-mycrd.yaml b/internal/harness/test_data/crd-in-step/01-create-mycrd.yaml similarity index 100% rename from pkg/test/harness/test_data/crd-in-step/01-create-mycrd.yaml rename to internal/harness/test_data/crd-in-step/01-create-mycrd.yaml diff --git a/pkg/test/harness/test_data/create-or-update/00-assert.yaml b/internal/harness/test_data/create-or-update/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/00-assert.yaml rename to internal/harness/test_data/create-or-update/00-assert.yaml diff --git a/pkg/test/harness/test_data/create-or-update/00-crd.yaml b/internal/harness/test_data/create-or-update/00-crd.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/00-crd.yaml rename to internal/harness/test_data/create-or-update/00-crd.yaml diff --git a/pkg/test/harness/test_data/create-or-update/01-assert.yaml b/internal/harness/test_data/create-or-update/01-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/01-assert.yaml rename to internal/harness/test_data/create-or-update/01-assert.yaml diff --git a/pkg/test/harness/test_data/create-or-update/01-create-deployment.yaml b/internal/harness/test_data/create-or-update/01-create-deployment.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/01-create-deployment.yaml rename to internal/harness/test_data/create-or-update/01-create-deployment.yaml diff --git a/pkg/test/harness/test_data/create-or-update/01-create-service.yaml b/internal/harness/test_data/create-or-update/01-create-service.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/01-create-service.yaml rename to internal/harness/test_data/create-or-update/01-create-service.yaml diff --git a/pkg/test/harness/test_data/create-or-update/01-create-unknown-crd.yaml b/internal/harness/test_data/create-or-update/01-create-unknown-crd.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/01-create-unknown-crd.yaml rename to internal/harness/test_data/create-or-update/01-create-unknown-crd.yaml diff --git a/pkg/test/harness/test_data/create-or-update/02-assert.yaml b/internal/harness/test_data/create-or-update/02-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/02-assert.yaml rename to internal/harness/test_data/create-or-update/02-assert.yaml diff --git a/pkg/test/harness/test_data/create-or-update/02-update-deployment.yaml b/internal/harness/test_data/create-or-update/02-update-deployment.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/02-update-deployment.yaml rename to internal/harness/test_data/create-or-update/02-update-deployment.yaml diff --git a/pkg/test/harness/test_data/create-or-update/02-update-service.yaml b/internal/harness/test_data/create-or-update/02-update-service.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/02-update-service.yaml rename to internal/harness/test_data/create-or-update/02-update-service.yaml diff --git a/pkg/test/harness/test_data/create-or-update/02-update-unknown-crd.yaml b/internal/harness/test_data/create-or-update/02-update-unknown-crd.yaml similarity index 100% rename from pkg/test/harness/test_data/create-or-update/02-update-unknown-crd.yaml rename to internal/harness/test_data/create-or-update/02-update-unknown-crd.yaml diff --git a/pkg/test/harness/test_data/delete-in-step/00-assert.yaml b/internal/harness/test_data/delete-in-step/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/delete-in-step/00-assert.yaml rename to internal/harness/test_data/delete-in-step/00-assert.yaml diff --git a/pkg/test/harness/test_data/delete-in-step/00-create.yaml b/internal/harness/test_data/delete-in-step/00-create.yaml similarity index 100% rename from pkg/test/harness/test_data/delete-in-step/00-create.yaml rename to internal/harness/test_data/delete-in-step/00-create.yaml diff --git a/pkg/test/harness/test_data/delete-in-step/01-assert.yaml b/internal/harness/test_data/delete-in-step/01-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/delete-in-step/01-assert.yaml rename to internal/harness/test_data/delete-in-step/01-assert.yaml diff --git a/pkg/test/harness/test_data/delete-in-step/01-create.yaml b/internal/harness/test_data/delete-in-step/01-create.yaml similarity index 100% rename from pkg/test/harness/test_data/delete-in-step/01-create.yaml rename to internal/harness/test_data/delete-in-step/01-create.yaml diff --git a/pkg/test/harness/test_data/list-pods/00-assert.yaml b/internal/harness/test_data/list-pods/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/list-pods/00-assert.yaml rename to internal/harness/test_data/list-pods/00-assert.yaml diff --git a/pkg/test/harness/test_data/list-pods/00-pod.yaml b/internal/harness/test_data/list-pods/00-pod.yaml similarity index 100% rename from pkg/test/harness/test_data/list-pods/00-pod.yaml rename to internal/harness/test_data/list-pods/00-pod.yaml diff --git a/pkg/test/harness/test_data/teststep-apply/00-assert.yaml b/internal/harness/test_data/teststep-apply/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-apply/00-assert.yaml rename to internal/harness/test_data/teststep-apply/00-assert.yaml diff --git a/pkg/test/harness/test_data/teststep-apply/00-create.yaml b/internal/harness/test_data/teststep-apply/00-create.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-apply/00-create.yaml rename to internal/harness/test_data/teststep-apply/00-create.yaml diff --git a/pkg/test/harness/test_data/teststep-apply/hello.yaml b/internal/harness/test_data/teststep-apply/hello.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-apply/hello.yaml rename to internal/harness/test_data/teststep-apply/hello.yaml diff --git a/pkg/test/harness/test_data/teststep-apply/hello2/hello2.yaml b/internal/harness/test_data/teststep-apply/hello2/hello2.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-apply/hello2/hello2.yaml rename to internal/harness/test_data/teststep-apply/hello2/hello2.yaml diff --git a/pkg/test/harness/test_data/teststep-assert/00-create.yaml b/internal/harness/test_data/teststep-assert/00-create.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-assert/00-create.yaml rename to internal/harness/test_data/teststep-assert/00-create.yaml diff --git a/pkg/test/harness/test_data/teststep-assert/hello1-assert.yaml b/internal/harness/test_data/teststep-assert/hello1-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-assert/hello1-assert.yaml rename to internal/harness/test_data/teststep-assert/hello1-assert.yaml diff --git a/pkg/test/harness/test_data/teststep-assert/hello2/hello2-assert.yaml b/internal/harness/test_data/teststep-assert/hello2/hello2-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-assert/hello2/hello2-assert.yaml rename to internal/harness/test_data/teststep-assert/hello2/hello2-assert.yaml diff --git a/pkg/test/harness/test_data/teststep-errors/00-assert.yaml b/internal/harness/test_data/teststep-errors/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-errors/00-assert.yaml rename to internal/harness/test_data/teststep-errors/00-assert.yaml diff --git a/pkg/test/harness/test_data/teststep-errors/00-create.yaml b/internal/harness/test_data/teststep-errors/00-create.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-errors/00-create.yaml rename to internal/harness/test_data/teststep-errors/00-create.yaml diff --git a/pkg/test/harness/test_data/teststep-errors/01-delete-error-check.yaml b/internal/harness/test_data/teststep-errors/01-delete-error-check.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-errors/01-delete-error-check.yaml rename to internal/harness/test_data/teststep-errors/01-delete-error-check.yaml diff --git a/pkg/test/harness/test_data/teststep-errors/hello1-error.yaml b/internal/harness/test_data/teststep-errors/hello1-error.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-errors/hello1-error.yaml rename to internal/harness/test_data/teststep-errors/hello1-error.yaml diff --git a/pkg/test/harness/test_data/teststep-errors/hello2/hello2-error.yaml b/internal/harness/test_data/teststep-errors/hello2/hello2-error.yaml similarity index 100% rename from pkg/test/harness/test_data/teststep-errors/hello2/hello2-error.yaml rename to internal/harness/test_data/teststep-errors/hello2/hello2-error.yaml diff --git a/pkg/test/harness/test_data/with-overrides/00-assert.yaml b/internal/harness/test_data/with-overrides/00-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/00-assert.yaml rename to internal/harness/test_data/with-overrides/00-assert.yaml diff --git a/pkg/test/harness/test_data/with-overrides/00-test-step.yaml b/internal/harness/test_data/with-overrides/00-test-step.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/00-test-step.yaml rename to internal/harness/test_data/with-overrides/00-test-step.yaml diff --git a/pkg/test/harness/test_data/with-overrides/01-assert.yaml b/internal/harness/test_data/with-overrides/01-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/01-assert.yaml rename to internal/harness/test_data/with-overrides/01-assert.yaml diff --git a/pkg/test/harness/test_data/with-overrides/01-test-assert.yaml b/internal/harness/test_data/with-overrides/01-test-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/01-test-assert.yaml rename to internal/harness/test_data/with-overrides/01-test-assert.yaml diff --git a/pkg/test/harness/test_data/with-overrides/02-directory/assert.yaml b/internal/harness/test_data/with-overrides/02-directory/assert.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/02-directory/assert.yaml rename to internal/harness/test_data/with-overrides/02-directory/assert.yaml diff --git a/pkg/test/harness/test_data/with-overrides/02-directory/pod.yaml b/internal/harness/test_data/with-overrides/02-directory/pod.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/02-directory/pod.yaml rename to internal/harness/test_data/with-overrides/02-directory/pod.yaml diff --git a/pkg/test/harness/test_data/with-overrides/02-directory/pod2.yaml b/internal/harness/test_data/with-overrides/02-directory/pod2.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/02-directory/pod2.yaml rename to internal/harness/test_data/with-overrides/02-directory/pod2.yaml diff --git a/pkg/test/harness/test_data/with-overrides/03-assert.yaml b/internal/harness/test_data/with-overrides/03-assert.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/03-assert.yaml rename to internal/harness/test_data/with-overrides/03-assert.yaml diff --git a/pkg/test/harness/test_data/with-overrides/03-pod.yaml b/internal/harness/test_data/with-overrides/03-pod.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/03-pod.yaml rename to internal/harness/test_data/with-overrides/03-pod.yaml diff --git a/pkg/test/harness/test_data/with-overrides/03-pod2.yaml b/internal/harness/test_data/with-overrides/03-pod2.yaml similarity index 100% rename from pkg/test/harness/test_data/with-overrides/03-pod2.yaml rename to internal/harness/test_data/with-overrides/03-pod2.yaml diff --git a/pkg/test/harness/test_data/with-overrides/README.md b/internal/harness/test_data/with-overrides/README.md similarity index 100% rename from pkg/test/harness/test_data/with-overrides/README.md rename to internal/harness/test_data/with-overrides/README.md diff --git a/pkg/http/client.go b/internal/http/client.go similarity index 98% rename from pkg/http/client.go rename to internal/http/client.go index 8d504b16..11f9d696 100644 --- a/pkg/http/client.go +++ b/internal/http/client.go @@ -12,7 +12,7 @@ import ( "github.com/dustin/go-humanize" - "github.com/kudobuilder/kuttl/pkg/version" + "github.com/kudobuilder/kuttl/internal/version" ) // Client is client used to simplified http requests for tarballs diff --git a/pkg/http/http.go b/internal/http/http.go similarity index 94% rename from pkg/http/http.go rename to internal/http/http.go index 66578eb9..3090afdd 100644 --- a/pkg/http/http.go +++ b/internal/http/http.go @@ -7,7 +7,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kudobuilder/kuttl/pkg/kubernetes" + "github.com/kudobuilder/kuttl/internal/kubernetes" ) // IsURL returns true if string is an URL diff --git a/pkg/http/http_test.go b/internal/http/http_test.go similarity index 100% rename from pkg/http/http_test.go rename to internal/http/http_test.go diff --git a/pkg/test/kind/kind.go b/internal/kind/kind.go similarity index 97% rename from pkg/test/kind/kind.go rename to internal/kind/kind.go index f69490ea..3ae22d6d 100644 --- a/pkg/test/kind/kind.go +++ b/internal/kind/kind.go @@ -10,7 +10,7 @@ import ( "sigs.k8s.io/kind/pkg/cluster/nodes" "sigs.k8s.io/kind/pkg/cluster/nodeutils" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) // Kind provides a thin abstraction layer for a KIND cluster. diff --git a/pkg/test/kind/kind_integration_test.go b/internal/kind/kind_integration_test.go similarity index 97% rename from pkg/test/kind/kind_integration_test.go rename to internal/kind/kind_integration_test.go index 42602ff7..343ab79e 100644 --- a/pkg/test/kind/kind_integration_test.go +++ b/internal/kind/kind_integration_test.go @@ -18,7 +18,7 @@ import ( "sigs.k8s.io/kind/pkg/apis/config/v1alpha4" "sigs.k8s.io/kind/pkg/cluster/nodes" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) const ( diff --git a/pkg/test/kind/kind_logger.go b/internal/kind/kind_logger.go similarity index 96% rename from pkg/test/kind/kind_logger.go rename to internal/kind/kind_logger.go index cd93d286..a9dcd645 100644 --- a/pkg/test/kind/kind_logger.go +++ b/internal/kind/kind_logger.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/pflag" "sigs.k8s.io/kind/pkg/log" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) type level int32 diff --git a/pkg/test/kind/kind_test.go b/internal/kind/kind_test.go similarity index 100% rename from pkg/test/kind/kind_test.go rename to internal/kind/kind_test.go diff --git a/pkg/kubernetes/client.go b/internal/kubernetes/client.go similarity index 100% rename from pkg/kubernetes/client.go rename to internal/kubernetes/client.go diff --git a/pkg/kubernetes/config.go b/internal/kubernetes/config.go similarity index 100% rename from pkg/kubernetes/config.go rename to internal/kubernetes/config.go diff --git a/pkg/kubernetes/fake/fake_client.go b/internal/kubernetes/fake/fake_client.go similarity index 100% rename from pkg/kubernetes/fake/fake_client.go rename to internal/kubernetes/fake/fake_client.go diff --git a/pkg/kubernetes/object.go b/internal/kubernetes/object.go similarity index 100% rename from pkg/kubernetes/object.go rename to internal/kubernetes/object.go diff --git a/pkg/kubernetes/object_test.go b/internal/kubernetes/object_test.go similarity index 97% rename from pkg/kubernetes/object_test.go rename to internal/kubernetes/object_test.go index ff4230a0..ad46f7c7 100644 --- a/pkg/kubernetes/object_test.go +++ b/internal/kubernetes/object_test.go @@ -9,7 +9,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/kudobuilder/kuttl/pkg/kubernetes/fake" + "github.com/kudobuilder/kuttl/internal/kubernetes/fake" ) func TestGETAPIResource(t *testing.T) { diff --git a/pkg/kubernetes/retry_client.go b/internal/kubernetes/retry_client.go similarity index 100% rename from pkg/kubernetes/retry_client.go rename to internal/kubernetes/retry_client.go diff --git a/pkg/kubernetes/retry_client_integration_test.go b/internal/kubernetes/retry_client_integration_test.go similarity index 100% rename from pkg/kubernetes/retry_client_integration_test.go rename to internal/kubernetes/retry_client_integration_test.go diff --git a/pkg/kubernetes/retry_client_test.go b/internal/kubernetes/retry_client_test.go similarity index 100% rename from pkg/kubernetes/retry_client_test.go rename to internal/kubernetes/retry_client_test.go diff --git a/pkg/kubernetes/scheme.go b/internal/kubernetes/scheme.go similarity index 100% rename from pkg/kubernetes/scheme.go rename to internal/kubernetes/scheme.go diff --git a/pkg/kubernetes/serialization.go b/internal/kubernetes/serialization.go similarity index 100% rename from pkg/kubernetes/serialization.go rename to internal/kubernetes/serialization.go diff --git a/pkg/kubernetes/serialization_test.go b/internal/kubernetes/serialization_test.go similarity index 100% rename from pkg/kubernetes/serialization_test.go rename to internal/kubernetes/serialization_test.go diff --git a/pkg/kubernetes/setup.go b/internal/kubernetes/setup.go similarity index 100% rename from pkg/kubernetes/setup.go rename to internal/kubernetes/setup.go diff --git a/pkg/kubernetes/test_data/prettydiff-actual.yaml b/internal/kubernetes/test_data/prettydiff-actual.yaml similarity index 100% rename from pkg/kubernetes/test_data/prettydiff-actual.yaml rename to internal/kubernetes/test_data/prettydiff-actual.yaml diff --git a/pkg/kubernetes/test_data/prettydiff-expected.yaml b/internal/kubernetes/test_data/prettydiff-expected.yaml similarity index 100% rename from pkg/kubernetes/test_data/prettydiff-expected.yaml rename to internal/kubernetes/test_data/prettydiff-expected.yaml diff --git a/pkg/kubernetes/unstructured.go b/internal/kubernetes/unstructured.go similarity index 100% rename from pkg/kubernetes/unstructured.go rename to internal/kubernetes/unstructured.go diff --git a/pkg/kubernetes/wait.go b/internal/kubernetes/wait.go similarity index 100% rename from pkg/kubernetes/wait.go rename to internal/kubernetes/wait.go diff --git a/pkg/kuttlctl/cmd/assert.go b/internal/kuttlctl/cmd/assert.go similarity index 95% rename from pkg/kuttlctl/cmd/assert.go rename to internal/kuttlctl/cmd/assert.go index e3904e2c..e0d39693 100644 --- a/pkg/kuttlctl/cmd/assert.go +++ b/internal/kuttlctl/cmd/assert.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/kudobuilder/kuttl/pkg/test/assert" + "github.com/kudobuilder/kuttl/internal/assert" ) var ( diff --git a/pkg/kuttlctl/cmd/errors.go b/internal/kuttlctl/cmd/errors.go similarity index 96% rename from pkg/kuttlctl/cmd/errors.go rename to internal/kuttlctl/cmd/errors.go index 9cd97eee..dda35722 100644 --- a/pkg/kuttlctl/cmd/errors.go +++ b/internal/kuttlctl/cmd/errors.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/kudobuilder/kuttl/pkg/test/assert" + "github.com/kudobuilder/kuttl/internal/assert" ) var ( diff --git a/pkg/kuttlctl/cmd/root.go b/internal/kuttlctl/cmd/root.go similarity index 91% rename from pkg/kuttlctl/cmd/root.go rename to internal/kuttlctl/cmd/root.go index 7195be37..53e51e8a 100644 --- a/pkg/kuttlctl/cmd/root.go +++ b/internal/kuttlctl/cmd/root.go @@ -3,8 +3,8 @@ package cmd import ( "github.com/spf13/cobra" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/version" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/version" ) // NewKuttlCmd creates a new root command for kuttlctl diff --git a/pkg/kuttlctl/cmd/root_test.go b/internal/kuttlctl/cmd/root_test.go similarity index 100% rename from pkg/kuttlctl/cmd/root_test.go rename to internal/kuttlctl/cmd/root_test.go diff --git a/pkg/kuttlctl/cmd/test.go b/internal/kuttlctl/cmd/test.go similarity index 97% rename from pkg/kuttlctl/cmd/test.go rename to internal/kuttlctl/cmd/test.go index a316d226..591ff213 100644 --- a/pkg/kuttlctl/cmd/test.go +++ b/internal/kuttlctl/cmd/test.go @@ -12,12 +12,12 @@ import ( "github.com/spf13/pflag" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "github.com/kudobuilder/kuttl/internal/harness" + "github.com/kudobuilder/kuttl/internal/kind" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/report" + testutils "github.com/kudobuilder/kuttl/internal/utils" harnessApi "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/report" - "github.com/kudobuilder/kuttl/pkg/test/harness" - "github.com/kudobuilder/kuttl/pkg/test/kind" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) var ( @@ -270,7 +270,7 @@ For more detailed documentation, visit: https://kuttl.dev`, testCmd.Flags().StringVarP(&namespace, "namespace", "n", "", "Namespace to use for tests. Provided namespaces must exist prior to running tests.") testCmd.Flags().StringSliceVar(&suppress, "suppress-log", []string{}, "Suppress logging for these kinds of logs (events).") testCmd.Flags().Var(&runLabels, "test-run-labels", "Labels to use for this test run.") - // This cannot be a global flag because pkg/test/utils.RunTests calls flag.Parse which barfs on unknown top-level flags. + // This cannot be a global flag because internal/utils.RunTests calls flag.Parse which barfs on unknown top-level flags. // Putting it here at least does not advertise it on a level where using it is impossible. kind.SetFlags(testCmd.Flags()) diff --git a/pkg/kuttlctl/cmd/values.go b/internal/kuttlctl/cmd/values.go similarity index 100% rename from pkg/kuttlctl/cmd/values.go rename to internal/kuttlctl/cmd/values.go diff --git a/pkg/kuttlctl/cmd/version.go b/internal/kuttlctl/cmd/version.go similarity index 93% rename from pkg/kuttlctl/cmd/version.go rename to internal/kuttlctl/cmd/version.go index 1f28da89..28d03b36 100644 --- a/pkg/kuttlctl/cmd/version.go +++ b/internal/kuttlctl/cmd/version.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/kudobuilder/kuttl/pkg/version" + "github.com/kudobuilder/kuttl/internal/version" ) var ( diff --git a/pkg/report/report.go b/internal/report/report.go similarity index 100% rename from pkg/report/report.go rename to internal/report/report.go diff --git a/pkg/report/report_test.go b/internal/report/report_test.go similarity index 100% rename from pkg/report/report_test.go rename to internal/report/report_test.go diff --git a/pkg/report/testdata/report.json.golden b/internal/report/testdata/report.json.golden similarity index 100% rename from pkg/report/testdata/report.json.golden rename to internal/report/testdata/report.json.golden diff --git a/pkg/report/testdata/report.xml.golden b/internal/report/testdata/report.xml.golden similarity index 100% rename from pkg/report/testdata/report.xml.golden rename to internal/report/testdata/report.xml.golden diff --git a/pkg/test/step/expression_integration_test.go b/internal/step/expression_integration_test.go similarity index 97% rename from pkg/test/step/expression_integration_test.go rename to internal/step/expression_integration_test.go index 11820ace..015fede9 100644 --- a/pkg/test/step/expression_integration_test.go +++ b/internal/step/expression_integration_test.go @@ -18,8 +18,8 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + "github.com/kudobuilder/kuttl/internal/kubernetes" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) func buildTestStep(t *testing.T, testenv kubernetes.TestEnvironment) *Step { diff --git a/pkg/test/step/step.go b/internal/step/step.go similarity index 98% rename from pkg/test/step/step.go rename to internal/step/step.go index 7a75cde6..f06e4cf0 100644 --- a/pkg/test/step/step.go +++ b/internal/step/step.go @@ -22,13 +22,13 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kudobuilder/kuttl/internal/env" + "github.com/kudobuilder/kuttl/internal/expressions" + kfile "github.com/kudobuilder/kuttl/internal/file" + "github.com/kudobuilder/kuttl/internal/http" + "github.com/kudobuilder/kuttl/internal/kubernetes" + testutils "github.com/kudobuilder/kuttl/internal/utils" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/env" - "github.com/kudobuilder/kuttl/pkg/expressions" - kfile "github.com/kudobuilder/kuttl/pkg/file" - "github.com/kudobuilder/kuttl/pkg/http" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) // fileNameRegex contains two capturing groups to determine whether a file has special diff --git a/pkg/test/step/step_integration_test.go b/internal/step/step_integration_test.go similarity index 99% rename from pkg/test/step/step_integration_test.go rename to internal/step/step_integration_test.go index a948a50d..54413d16 100644 --- a/pkg/test/step/step_integration_test.go +++ b/internal/step/step_integration_test.go @@ -18,9 +18,9 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kudobuilder/kuttl/internal/kubernetes" + testutils "github.com/kudobuilder/kuttl/internal/utils" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) var testenv kubernetes.TestEnvironment diff --git a/pkg/test/step/step_test.go b/internal/step/step_test.go similarity index 98% rename from pkg/test/step/step_test.go rename to internal/step/step_test.go index 4c9c90a9..099496b0 100644 --- a/pkg/test/step/step_test.go +++ b/internal/step/step_test.go @@ -16,10 +16,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + "github.com/kudobuilder/kuttl/internal/kubernetes" + k8sfake "github.com/kudobuilder/kuttl/internal/kubernetes/fake" + testutils "github.com/kudobuilder/kuttl/internal/utils" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - k8sfake "github.com/kudobuilder/kuttl/pkg/kubernetes/fake" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) const ( diff --git a/pkg/test/step/test_data/assert_commands/command_does_not_exist/00-assert.yaml b/internal/step/test_data/assert_commands/command_does_not_exist/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/command_does_not_exist/00-assert.yaml rename to internal/step/test_data/assert_commands/command_does_not_exist/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_commands/failing_comand/00-assert.yaml b/internal/step/test_data/assert_commands/failing_comand/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/failing_comand/00-assert.yaml rename to internal/step/test_data/assert_commands/failing_comand/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_commands/multiple_commands/00-assert.yaml b/internal/step/test_data/assert_commands/multiple_commands/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/multiple_commands/00-assert.yaml rename to internal/step/test_data/assert_commands/multiple_commands/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_commands/path_script/00-assert.yaml b/internal/step/test_data/assert_commands/path_script/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/path_script/00-assert.yaml rename to internal/step/test_data/assert_commands/path_script/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_commands/path_script/00-step.yaml b/internal/step/test_data/assert_commands/path_script/00-step.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/path_script/00-step.yaml rename to internal/step/test_data/assert_commands/path_script/00-step.yaml diff --git a/pkg/test/step/test_data/assert_commands/path_script/test/script.sh b/internal/step/test_data/assert_commands/path_script/test/script.sh similarity index 100% rename from pkg/test/step/test_data/assert_commands/path_script/test/script.sh rename to internal/step/test_data/assert_commands/path_script/test/script.sh diff --git a/pkg/test/step/test_data/assert_commands/timingout_command/00-assert.yaml b/internal/step/test_data/assert_commands/timingout_command/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/timingout_command/00-assert.yaml rename to internal/step/test_data/assert_commands/timingout_command/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_commands/valid_command/00-assert.yaml b/internal/step/test_data/assert_commands/valid_command/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_commands/valid_command/00-assert.yaml rename to internal/step/test_data/assert_commands/valid_command/00-assert.yaml diff --git a/pkg/test/step/test_data/assert_expand/00-step1.yaml b/internal/step/test_data/assert_expand/00-step1.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expand/00-step1.yaml rename to internal/step/test_data/assert_expand/00-step1.yaml diff --git a/pkg/test/step/test_data/assert_expand/test/test.yaml b/internal/step/test_data/assert_expand/test/test.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expand/test/test.yaml rename to internal/step/test_data/assert_expand/test/test.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_deployment_name/assert.yaml b/internal/step/test_data/assert_expressions/check_deployment_name/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_deployment_name/assert.yaml rename to internal/step/test_data/assert_expressions/check_deployment_name/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/assert.yaml b/internal/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/assert.yaml rename to internal/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/pod.yaml b/internal/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/pod.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/pod.yaml rename to internal/step/test_data/assert_expressions/check_expression_for_ephemeral_namespace/pod.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_incorrect_deployment_name/assert.yaml b/internal/step/test_data/assert_expressions/check_incorrect_deployment_name/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_incorrect_deployment_name/assert.yaml rename to internal/step/test_data/assert_expressions/check_incorrect_deployment_name/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_multiple_assert_all/assert.yaml b/internal/step/test_data/assert_expressions/check_multiple_assert_all/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_multiple_assert_all/assert.yaml rename to internal/step/test_data/assert_expressions/check_multiple_assert_all/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_multiple_assert_all_with_one_failing/assert.yaml b/internal/step/test_data/assert_expressions/check_multiple_assert_all_with_one_failing/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_multiple_assert_all_with_one_failing/assert.yaml rename to internal/step/test_data/assert_expressions/check_multiple_assert_all_with_one_failing/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_multiple_assert_any/assert.yaml b/internal/step/test_data/assert_expressions/check_multiple_assert_any/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_multiple_assert_any/assert.yaml rename to internal/step/test_data/assert_expressions/check_multiple_assert_any/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/check_multiple_assert_any_with_all_failing/assert.yaml b/internal/step/test_data/assert_expressions/check_multiple_assert_any_with_all_failing/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/check_multiple_assert_any_with_all_failing/assert.yaml rename to internal/step/test_data/assert_expressions/check_multiple_assert_any_with_all_failing/assert.yaml diff --git a/pkg/test/step/test_data/assert_expressions/invalid_expression/assert.yaml b/internal/step/test_data/assert_expressions/invalid_expression/assert.yaml similarity index 100% rename from pkg/test/step/test_data/assert_expressions/invalid_expression/assert.yaml rename to internal/step/test_data/assert_expressions/invalid_expression/assert.yaml diff --git a/pkg/test/step/test_data/error_detect/00-apply.yaml b/internal/step/test_data/error_detect/00-apply.yaml similarity index 100% rename from pkg/test/step/test_data/error_detect/00-apply.yaml rename to internal/step/test_data/error_detect/00-apply.yaml diff --git a/pkg/test/step/test_data/error_detect/00-assert.yaml b/internal/step/test_data/error_detect/00-assert.yaml similarity index 100% rename from pkg/test/step/test_data/error_detect/00-assert.yaml rename to internal/step/test_data/error_detect/00-assert.yaml diff --git a/pkg/test/step/test_data/kubeconfig_path_resolution/00-step1.yaml b/internal/step/test_data/kubeconfig_path_resolution/00-step1.yaml similarity index 100% rename from pkg/test/step/test_data/kubeconfig_path_resolution/00-step1.yaml rename to internal/step/test_data/kubeconfig_path_resolution/00-step1.yaml diff --git a/pkg/test/step/test_data/kubeconfig_path_resolution/00-step2.yaml b/internal/step/test_data/kubeconfig_path_resolution/00-step2.yaml similarity index 100% rename from pkg/test/step/test_data/kubeconfig_path_resolution/00-step2.yaml rename to internal/step/test_data/kubeconfig_path_resolution/00-step2.yaml diff --git a/pkg/test/step/test_data/two_step/00-step1.yaml b/internal/step/test_data/two_step/00-step1.yaml similarity index 100% rename from pkg/test/step/test_data/two_step/00-step1.yaml rename to internal/step/test_data/two_step/00-step1.yaml diff --git a/pkg/test/step/test_data/two_step/00-step2.yaml b/internal/step/test_data/two_step/00-step2.yaml similarity index 100% rename from pkg/test/step/test_data/two_step/00-step2.yaml rename to internal/step/test_data/two_step/00-step2.yaml diff --git a/pkg/test/step/test_data/two_step/01-step1.yaml b/internal/step/test_data/two_step/01-step1.yaml similarity index 100% rename from pkg/test/step/test_data/two_step/01-step1.yaml rename to internal/step/test_data/two_step/01-step1.yaml diff --git a/pkg/test/testcase/case.go b/internal/testcase/case.go similarity index 96% rename from pkg/test/testcase/case.go rename to internal/testcase/case.go index 8e9aac18..b9e6ee94 100644 --- a/pkg/test/testcase/case.go +++ b/internal/testcase/case.go @@ -18,13 +18,13 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/report" + "github.com/kudobuilder/kuttl/internal/step" + testutils "github.com/kudobuilder/kuttl/internal/utils" + eventutils "github.com/kudobuilder/kuttl/internal/utils/events" + "github.com/kudobuilder/kuttl/internal/utils/files" "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/report" - "github.com/kudobuilder/kuttl/pkg/test/step" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" - eventutils "github.com/kudobuilder/kuttl/pkg/test/utils/events" - "github.com/kudobuilder/kuttl/pkg/test/utils/files" ) type getClientFuncType func(forceNew bool) (client.Client, error) diff --git a/pkg/test/testcase/case_integration_test.go b/internal/testcase/case_integration_test.go similarity index 93% rename from pkg/test/testcase/case_integration_test.go rename to internal/testcase/case_integration_test.go index 7658bfb5..5bd58681 100644 --- a/pkg/test/testcase/case_integration_test.go +++ b/internal/testcase/case_integration_test.go @@ -9,10 +9,10 @@ import ( "k8s.io/client-go/discovery" "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/report" - "github.com/kudobuilder/kuttl/pkg/test/step" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/report" + "github.com/kudobuilder/kuttl/internal/step" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) // Create two test environments, ensure that the second environment is used when diff --git a/pkg/test/testcase/case_test.go b/internal/testcase/case_test.go similarity index 98% rename from pkg/test/testcase/case_test.go rename to internal/testcase/case_test.go index 7218f571..425b561d 100644 --- a/pkg/test/testcase/case_test.go +++ b/internal/testcase/case_test.go @@ -11,10 +11,10 @@ import ( "k8s.io/apimachinery/pkg/labels" "sigs.k8s.io/controller-runtime/pkg/client" + "github.com/kudobuilder/kuttl/internal/kubernetes" + "github.com/kudobuilder/kuttl/internal/step" + testutils "github.com/kudobuilder/kuttl/internal/utils" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/kubernetes" - "github.com/kudobuilder/kuttl/pkg/test/step" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" ) // Verify the test state as loaded from disk. diff --git a/pkg/test/testcase/test_data/list-pods/00-assert.yaml b/internal/testcase/test_data/list-pods/00-assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/list-pods/00-assert.yaml rename to internal/testcase/test_data/list-pods/00-assert.yaml diff --git a/pkg/test/testcase/test_data/list-pods/00-pod.yaml b/internal/testcase/test_data/list-pods/00-pod.yaml similarity index 100% rename from pkg/test/testcase/test_data/list-pods/00-pod.yaml rename to internal/testcase/test_data/list-pods/00-pod.yaml diff --git a/pkg/test/testcase/test_data/test-run-labels/01-assert-a.yaml b/internal/testcase/test_data/test-run-labels/01-assert-a.yaml similarity index 100% rename from pkg/test/testcase/test_data/test-run-labels/01-assert-a.yaml rename to internal/testcase/test_data/test-run-labels/01-assert-a.yaml diff --git a/pkg/test/testcase/test_data/test-run-labels/01-assert-b.yaml b/internal/testcase/test_data/test-run-labels/01-assert-b.yaml similarity index 100% rename from pkg/test/testcase/test_data/test-run-labels/01-assert-b.yaml rename to internal/testcase/test_data/test-run-labels/01-assert-b.yaml diff --git a/pkg/test/testcase/test_data/test-run-labels/01-create-a.yaml b/internal/testcase/test_data/test-run-labels/01-create-a.yaml similarity index 100% rename from pkg/test/testcase/test_data/test-run-labels/01-create-a.yaml rename to internal/testcase/test_data/test-run-labels/01-create-a.yaml diff --git a/pkg/test/testcase/test_data/test-run-labels/01-create-b.yaml b/internal/testcase/test_data/test-run-labels/01-create-b.yaml similarity index 100% rename from pkg/test/testcase/test_data/test-run-labels/01-create-b.yaml rename to internal/testcase/test_data/test-run-labels/01-create-b.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/00-assert.yaml b/internal/testcase/test_data/with-overrides/00-assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/00-assert.yaml rename to internal/testcase/test_data/with-overrides/00-assert.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/00-test-step.yaml b/internal/testcase/test_data/with-overrides/00-test-step.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/00-test-step.yaml rename to internal/testcase/test_data/with-overrides/00-test-step.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/01-assert.yaml b/internal/testcase/test_data/with-overrides/01-assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/01-assert.yaml rename to internal/testcase/test_data/with-overrides/01-assert.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/01-test-assert.yaml b/internal/testcase/test_data/with-overrides/01-test-assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/01-test-assert.yaml rename to internal/testcase/test_data/with-overrides/01-test-assert.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/02-directory/assert.yaml b/internal/testcase/test_data/with-overrides/02-directory/assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/02-directory/assert.yaml rename to internal/testcase/test_data/with-overrides/02-directory/assert.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/02-directory/pod.yaml b/internal/testcase/test_data/with-overrides/02-directory/pod.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/02-directory/pod.yaml rename to internal/testcase/test_data/with-overrides/02-directory/pod.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/02-directory/pod2.yaml b/internal/testcase/test_data/with-overrides/02-directory/pod2.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/02-directory/pod2.yaml rename to internal/testcase/test_data/with-overrides/02-directory/pod2.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/03-assert.yaml b/internal/testcase/test_data/with-overrides/03-assert.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/03-assert.yaml rename to internal/testcase/test_data/with-overrides/03-assert.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/03-pod.yaml b/internal/testcase/test_data/with-overrides/03-pod.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/03-pod.yaml rename to internal/testcase/test_data/with-overrides/03-pod.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/03-pod2.yaml b/internal/testcase/test_data/with-overrides/03-pod2.yaml similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/03-pod2.yaml rename to internal/testcase/test_data/with-overrides/03-pod2.yaml diff --git a/pkg/test/testcase/test_data/with-overrides/README.md b/internal/testcase/test_data/with-overrides/README.md similarity index 100% rename from pkg/test/testcase/test_data/with-overrides/README.md rename to internal/testcase/test_data/with-overrides/README.md diff --git a/pkg/test/utils/commands.go b/internal/utils/commands.go similarity index 99% rename from pkg/test/utils/commands.go rename to internal/utils/commands.go index 51675645..07135657 100644 --- a/pkg/test/utils/commands.go +++ b/internal/utils/commands.go @@ -16,8 +16,8 @@ import ( "github.com/spf13/pflag" _ "k8s.io/client-go/plugin/pkg/client/auth" // package needed for auth providers like GCP + "github.com/kudobuilder/kuttl/internal/env" harness "github.com/kudobuilder/kuttl/pkg/apis/testharness/v1beta1" - "github.com/kudobuilder/kuttl/pkg/env" ) // GetArgs parses a command line string into its arguments and appends a namespace if it is not already set. diff --git a/pkg/test/utils/commands_test.go b/internal/utils/commands_test.go similarity index 100% rename from pkg/test/utils/commands_test.go rename to internal/utils/commands_test.go diff --git a/pkg/test/utils/docker.go b/internal/utils/docker.go similarity index 100% rename from pkg/test/utils/docker.go rename to internal/utils/docker.go diff --git a/pkg/test/utils/events/events.go b/internal/utils/events/events.go similarity index 98% rename from pkg/test/utils/events/events.go rename to internal/utils/events/events.go index 978ecf31..100f3b53 100644 --- a/pkg/test/utils/events/events.go +++ b/internal/utils/events/events.go @@ -10,7 +10,7 @@ import ( eventsbeta1 "k8s.io/api/events/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) // byFirstTimestamp sorts a slice of events by first timestamp, using their involvedObject's name as a tie breaker. diff --git a/pkg/test/utils/files/files.go b/internal/utils/files/files.go similarity index 96% rename from pkg/test/utils/files/files.go rename to internal/utils/files/files.go index 36c475ab..726df924 100644 --- a/pkg/test/utils/files/files.go +++ b/internal/utils/files/files.go @@ -6,7 +6,7 @@ import ( "regexp" "strconv" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) // testStepRegex contains one capturing group to determine the index of a step file. diff --git a/pkg/test/utils/files/files_test.go b/internal/utils/files/files_test.go similarity index 96% rename from pkg/test/utils/files/files_test.go rename to internal/utils/files/files_test.go index 5b667e1d..5f242dfb 100644 --- a/pkg/test/utils/files/files_test.go +++ b/internal/utils/files/files_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - testutils "github.com/kudobuilder/kuttl/pkg/test/utils" + testutils "github.com/kudobuilder/kuttl/internal/utils" ) func TestCollectTestStepFiles(t *testing.T) { diff --git a/pkg/test/utils/files/test_data/list-pods/00-assert.yaml b/internal/utils/files/test_data/list-pods/00-assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/list-pods/00-assert.yaml rename to internal/utils/files/test_data/list-pods/00-assert.yaml diff --git a/pkg/test/utils/files/test_data/list-pods/00-pod.yaml b/internal/utils/files/test_data/list-pods/00-pod.yaml similarity index 100% rename from pkg/test/utils/files/test_data/list-pods/00-pod.yaml rename to internal/utils/files/test_data/list-pods/00-pod.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/00-assert.yaml b/internal/utils/files/test_data/with-overrides/00-assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/00-assert.yaml rename to internal/utils/files/test_data/with-overrides/00-assert.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/00-test-step.yaml b/internal/utils/files/test_data/with-overrides/00-test-step.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/00-test-step.yaml rename to internal/utils/files/test_data/with-overrides/00-test-step.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/01-assert.yaml b/internal/utils/files/test_data/with-overrides/01-assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/01-assert.yaml rename to internal/utils/files/test_data/with-overrides/01-assert.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/01-test-assert.yaml b/internal/utils/files/test_data/with-overrides/01-test-assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/01-test-assert.yaml rename to internal/utils/files/test_data/with-overrides/01-test-assert.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/02-directory/assert.yaml b/internal/utils/files/test_data/with-overrides/02-directory/assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/02-directory/assert.yaml rename to internal/utils/files/test_data/with-overrides/02-directory/assert.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/02-directory/pod.yaml b/internal/utils/files/test_data/with-overrides/02-directory/pod.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/02-directory/pod.yaml rename to internal/utils/files/test_data/with-overrides/02-directory/pod.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/02-directory/pod2.yaml b/internal/utils/files/test_data/with-overrides/02-directory/pod2.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/02-directory/pod2.yaml rename to internal/utils/files/test_data/with-overrides/02-directory/pod2.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/03-assert.yaml b/internal/utils/files/test_data/with-overrides/03-assert.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/03-assert.yaml rename to internal/utils/files/test_data/with-overrides/03-assert.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/03-pod.yaml b/internal/utils/files/test_data/with-overrides/03-pod.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/03-pod.yaml rename to internal/utils/files/test_data/with-overrides/03-pod.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/03-pod2.yaml b/internal/utils/files/test_data/with-overrides/03-pod2.yaml similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/03-pod2.yaml rename to internal/utils/files/test_data/with-overrides/03-pod2.yaml diff --git a/pkg/test/utils/files/test_data/with-overrides/README.md b/internal/utils/files/test_data/with-overrides/README.md similarity index 100% rename from pkg/test/utils/files/test_data/with-overrides/README.md rename to internal/utils/files/test_data/with-overrides/README.md diff --git a/pkg/test/utils/logger.go b/internal/utils/logger.go similarity index 100% rename from pkg/test/utils/logger.go rename to internal/utils/logger.go diff --git a/pkg/test/utils/subset.go b/internal/utils/subset.go similarity index 100% rename from pkg/test/utils/subset.go rename to internal/utils/subset.go diff --git a/pkg/test/utils/subset_test.go b/internal/utils/subset_test.go similarity index 100% rename from pkg/test/utils/subset_test.go rename to internal/utils/subset_test.go diff --git a/pkg/test/utils/testing.go b/internal/utils/testing.go similarity index 100% rename from pkg/test/utils/testing.go rename to internal/utils/testing.go diff --git a/pkg/version/base.go b/internal/version/base.go similarity index 100% rename from pkg/version/base.go rename to internal/version/base.go diff --git a/pkg/version/version.go b/internal/version/version.go similarity index 97% rename from pkg/version/version.go rename to internal/version/version.go index 599ff155..bb0ae630 100644 --- a/pkg/version/version.go +++ b/internal/version/version.go @@ -28,7 +28,7 @@ func (info Info) String() string { // what code a binary was built from. func Get() Info { // These variables typically come from -ldflags settings and in - // their absence fallback to the settings in pkg/version/base.go + // their absence fallback to the settings in internal/version/base.go // developer fallback for version // this only happens when running from a build. Release runs ARE correct. diff --git a/pkg/version/version_test.go b/internal/version/version_test.go similarity index 100% rename from pkg/version/version_test.go rename to internal/version/version_test.go diff --git a/pkg/test/harness.go b/pkg/test/harness.go new file mode 100644 index 00000000..7a193ee8 --- /dev/null +++ b/pkg/test/harness.go @@ -0,0 +1,8 @@ +package test + +import "github.com/kudobuilder/kuttl/internal/harness" + +// This type alias is here to avoid breaking the only apparent active user of kuttl Go API, +// https://github.com/kube-green/kube-green/blob/main/tests/integration/kuttl_test.go + +type Harness = harness.Harness