Skip to content

Commit

Permalink
fix: adjust docker api version setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kimdre committed Aug 4, 2024
1 parent 773a3df commit f35d7db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ jobs:
- run: go mod download
- run: go test -v -cover -p 1 ./internal/...
timeout-minutes: 5
env:
WEBHOOK_SECRET: test_Secret1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BINARY_NAME=docker-compose-webhook

test:
@echo "Running tests..."
@go test -p 1 -v ./... -timeout 5m
@WEBHOOK_SECRET="test_Secret1" go test -p 1 -v ./... -timeout 5m

build:
mkdir -p $(BINARY_DIR)
Expand Down
19 changes: 14 additions & 5 deletions internal/docker/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ func createTestFile(fileName string, content string) error {
}

var (
dockerAPIVersion = "v1.40"
projectName = "test"
composeContents = `services:
projectName = "test"
composeContents = `services:
test:
image: nginx:latest
environment:
Expand All @@ -49,7 +48,12 @@ var (
)

func TestVerifySocketConnection(t *testing.T) {
err := VerifySocketConnection(dockerAPIVersion)
c, err := config.GetAppConfig()
if err != nil {
t.Fatal(err)
}

err = VerifySocketConnection(c.DockerAPIVersion)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -82,9 +86,14 @@ func TestLoadCompose(t *testing.T) {
}

func TestDeployCompose(t *testing.T) {
c, err := config.GetAppConfig()
if err != nil {
t.Fatal(err)
}

t.Log("Verify socket connection")

err := VerifySocketConnection(dockerAPIVersion)
err = VerifySocketConnection(c.DockerAPIVersion)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit f35d7db

Please sign in to comment.