Skip to content

Commit

Permalink
Use docker compose v2 without alias
Browse files Browse the repository at this point in the history
  • Loading branch information
secwall committed Apr 4, 2024
1 parent a25bf00 commit cd21650
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jepsen_test:
GOOS=linux go build -tags netgo,osusergo -o ./cmd/mysync/mysync ./cmd/mysync/...
go build ./tests/...
rm -fr ./tests/images/mysql_jepsen/mysync && cp ./cmd/mysync/mysync ./tests/images/mysql_jepsen/mysync
docker-compose -p mysync -f ./tests/images/jepsen-compose.yml up -d --force-recreate --build
docker compose -p mysync -f ./tests/images/jepsen-compose.yml up -d --force-recreate --build
timeout 600 docker exec mysync_zoo1_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper1_1.mysync_mysql_net
timeout 600 docker exec mysync_zoo2_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper2_1.mysync_mysql_net
timeout 600 docker exec mysync_zoo3_1 /usr/local/bin/generate_certs_with_restart.sh mysync_zookeeper3_1.mysync_mysql_net
Expand All @@ -48,7 +48,7 @@ jepsen_test:
timeout 600 docker exec mysync_mysql1_1 setup.sh
mkdir -p ./tests/logs
(docker exec mysync_jepsen_1 /root/jepsen/run.sh > ./tests/logs/jepsen.log 2>&1 && tail -n 4 ./tests/logs/jepsen.log) || ./tests/images/jepsen_main/save_logs.sh
docker-compose -p mysync -f ./tests/images/jepsen-compose.yml down --rmi all
docker compose -p mysync -f ./tests/images/jepsen-compose.yml down --rmi all

clean:
docker ps | grep mysync | awk '{print $$1}' | xargs docker rm -f || true
Expand Down
8 changes: 4 additions & 4 deletions tests/testutil/docker_composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Composer interface {
CheckIfFileExist(service, path string) (bool, error)
}

// DockerComposer is a Composer implementation based on docker and docker-compose
// DockerComposer is a Composer implementation based on docker and docker compose
type DockerComposer struct {
projectName string
config string
Expand Down Expand Up @@ -92,14 +92,14 @@ func NewDockerComposer(project, config string) (*DockerComposer, error) {
}

func (dc *DockerComposer) runCompose(args []string, env []string) error {
args2 := []string{}
args2 := []string{"compose"}
args2 = append(args2, "-f", dc.config, "-p", dc.projectName)
args2 = append(args2, args...)
cmd := exec.Command("docker-compose", args2...)
cmd := exec.Command("docker", args2...)
cmd.Env = append(os.Environ(), env...)
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("failed to run 'docker-compose %s': %s\n%s", strings.Join(args2, " "), err, out)
return fmt.Errorf("failed to run 'docker compose %s': %s\n%s", strings.Join(args2, " "), err, out)
}
return nil
}
Expand Down

0 comments on commit cd21650

Please sign in to comment.