Skip to content

Commit f4c49d8

Browse files
authored
chore: move packages to internal (#632)
We should not be exposing all code as a public API. Leave just the apis directory and the Harness type in pkg/ to avoid the single active user that I could find. When doing this, flatten the structure by moving packages under the `pkg/test` package directly into `internal`. Signed-off-by: Marcin Owsiany <[email protected]>
1 parent 69b8493 commit f4c49d8

File tree

182 files changed

+81
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+81
-79
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ builds:
1313
binary: kubectl-kuttl
1414
main: cmd/kubectl-kuttl/main.go
1515
ldflags:
16-
- -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 }}
16+
- -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 }}
1717
goos:
1818
- linux
1919
- darwin

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
SHELL=/bin/bash -o pipefail
22

33
CLI := kubectl-kuttl
4-
GIT_VERSION_PATH := github.com/kudobuilder/kuttl/pkg/version.gitVersion
4+
GIT_VERSION_PATH := github.com/kudobuilder/kuttl/internal/version.gitVersion
55
GIT_VERSION := $(shell git describe --abbrev=0 --tags | cut -b 2-)
6-
GIT_COMMIT_PATH := github.com/kudobuilder/kuttl/pkg/version.gitCommit
6+
GIT_COMMIT_PATH := github.com/kudobuilder/kuttl/internal/version.gitCommit
77
GIT_COMMIT := $(shell git rev-parse HEAD | cut -b -8)
88
SOURCE_DATE_EPOCH := $(shell git show -s --format=format:%ct HEAD)
9-
BUILD_DATE_PATH := github.com/kudobuilder/kuttl/pkg/version.buildDate
9+
BUILD_DATE_PATH := github.com/kudobuilder/kuttl/internal/version.buildDate
1010
DATE_FMT := "%Y-%m-%dT%H:%M:%SZ"
1111
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}")
1212
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
131131
test: ## Runs unit tests
132132
ifdef _INTELLIJ_FORCE_SET_GOFLAGS
133133
# Run tests from a Goland terminal. Goland already set '-mod=readonly'
134-
go test ./pkg/... -v -coverprofile cover.out
134+
go test ./pkg/... ./internal/... -v -coverprofile cover.out
135135
else
136-
go test ./pkg/... -v -mod=readonly -coverprofile cover.out
136+
go test ./pkg/... ./internal/... -v -mod=readonly -coverprofile cover.out
137137
endif
138138

139139
.PHONY: integration-test

cmd/kubectl-kuttl/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package main
1717
import (
1818
"os"
1919

20-
"github.com/kudobuilder/kuttl/pkg/kuttlctl/cmd"
20+
"github.com/kudobuilder/kuttl/internal/kuttlctl/cmd"
2121
)
2222

2323
func main() {

docs/api-integration.md

Lines changed: 2 additions & 8 deletions

docs/cli.md

Lines changed: 3 additions & 3 deletions

hack/run-integration-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ then
1414
go get github.com/jstemmer/go-junit-report
1515
go install github.com/jstemmer/go-junit-report
1616
go mod tidy
17-
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
17+
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
1818
else
1919
echo "Running integration tests without junit output"
20-
go test -tags integration ./pkg/... -v -mod=readonly -coverprofile cover-integration.out
20+
go test -tags integration ./pkg/... ./internal/... -v -mod=readonly -coverprofile cover-integration.out
2121
fi

pkg/test/assert/assert.go renamed to internal/assert/assert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"k8s.io/client-go/discovery"
99
"sigs.k8s.io/controller-runtime/pkg/client"
1010

11-
"github.com/kudobuilder/kuttl/pkg/kubernetes"
12-
"github.com/kudobuilder/kuttl/pkg/test/step"
11+
"github.com/kudobuilder/kuttl/internal/kubernetes"
12+
"github.com/kudobuilder/kuttl/internal/step"
1313
)
1414

1515
// Assert checks all provided assert files against a namespace. Upon assert failure, it prints the failures and returns an error
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)