mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 12:07:45 +01:00
tests: run unit tests outside of docker by default
This allows execution of unit tests within the devcontainer environment, which already has the correct golang.
This commit is contained in:
@@ -28,7 +28,7 @@ func setupTests() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupTestApp() (err error) {
|
func setupTestApp() (err error) {
|
||||||
Expect(os.MkdirAll(testAppDir, 0644)).To(Succeed())
|
Expect(os.MkdirAll(testAppDir, 0766)).To(Succeed())
|
||||||
b := []byte(testEnvLine + "\n")
|
b := []byte(testEnvLine + "\n")
|
||||||
if err = os.WriteFile(testEnvFile, b, 0644); err != nil {
|
if err = os.WriteFile(testEnvFile, b, 0644); err != nil {
|
||||||
return
|
return
|
||||||
@@ -37,7 +37,7 @@ func setupTestApp() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupTestApp2() (err error) {
|
func setupTestApp2() (err error) {
|
||||||
Expect(os.MkdirAll(testAppDir2, 0644)).To(Succeed())
|
Expect(os.MkdirAll(testAppDir2, 0766)).To(Succeed())
|
||||||
b := []byte(testEnvLine2 + "\n")
|
b := []byte(testEnvLine2 + "\n")
|
||||||
if err = os.WriteFile(testEnvFile2, b, 0644); err != nil {
|
if err = os.WriteFile(testEnvFile2, b, 0644); err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
6
tests.mk
6
tests.mk
@@ -179,14 +179,16 @@ go-tests:
|
|||||||
@$(MAKE) go-test-plugin PLUGIN_NAME=network
|
@$(MAKE) go-test-plugin PLUGIN_NAME=network
|
||||||
|
|
||||||
go-test-plugin:
|
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...
|
@echo running go unit tests...
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e DOKKU_ROOT=/home/dokku \
|
|
||||||
-e GO111MODULE=on \
|
-e GO111MODULE=on \
|
||||||
-v $$PWD:$(GO_REPO_ROOT) \
|
-v $$PWD:$(GO_REPO_ROOT) \
|
||||||
-w $(GO_REPO_ROOT) \
|
-w $(GO_REPO_ROOT) \
|
||||||
$(BUILD_IMAGE) \
|
$(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
|
unit-tests: go-tests
|
||||||
@echo running bats unit tests...
|
@echo running bats unit tests...
|
||||||
|
|||||||
Reference in New Issue
Block a user