Skip to content

Commit

Permalink
Merge pull request dokku#7380 from dokku/7375-unit-test-devcontainer
Browse files Browse the repository at this point in the history
Run unit tests outside of docker by default
  • Loading branch information
josegonzalez authored Dec 4, 2024
2 parents 2321f01 + f20a6a2 commit 3bb9bc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func setupTests() (err error) {
}

func setupTestApp() (err error) {
Expect(os.MkdirAll(testAppDir, 0644)).To(Succeed())
Expect(os.MkdirAll(testAppDir, 0766)).To(Succeed())
b := []byte(testEnvLine + "\n")
if err = os.WriteFile(testEnvFile, b, 0644); err != nil {
return
Expand All @@ -37,7 +37,7 @@ func setupTestApp() (err error) {
}

func setupTestApp2() (err error) {
Expect(os.MkdirAll(testAppDir2, 0644)).To(Succeed())
Expect(os.MkdirAll(testAppDir2, 0766)).To(Succeed())
b := []byte(testEnvLine2 + "\n")
if err = os.WriteFile(testEnvFile2, b, 0644); err != nil {
return
Expand Down
6 changes: 4 additions & 2 deletions tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,16 @@ go-tests:
@$(MAKE) go-test-plugin PLUGIN_NAME=network

go-test-plugin:
cd plugins/$(PLUGIN_NAME) && go get github.com/onsi/gomega && DOKKU_ROOT=/home/dokku go test -v -p 1 -race -mod=readonly || exit $$?

go-test-plugin-in-docker:
@echo running go unit tests...
docker run --rm \
-e DOKKU_ROOT=/home/dokku \
-e GO111MODULE=on \
-v $$PWD:$(GO_REPO_ROOT) \
-w $(GO_REPO_ROOT) \
$(BUILD_IMAGE) \
bash -c "cd plugins/$(PLUGIN_NAME) && go get github.com/onsi/gomega && go test -v -p 1 -race -mod=readonly " || exit $$?
bash -c "make go-test-plugin PLUGIN_NAME=$(PLUGIN_NAME)" || exit $$?

unit-tests: go-tests
@echo running bats unit tests...
Expand Down

0 comments on commit 3bb9bc1

Please sign in to comment.