Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker compose v2 without alias #97

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading