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 testcontainers to run redis-server #1960

Merged
merged 1 commit into from
Feb 18, 2022

Conversation

AlexanderYastrebov
Copy link
Member

Mitigates build failures caused by package manager redirects during redis-server installation.
Note that change adds many dependencies but they are only used for tests and do not end up in the build.

Signed-off-by: Alexander Yastrebov alexander.yastrebov@zalando.de

@AlexanderYastrebov
Copy link
Member Author

AlexanderYastrebov commented Feb 17, 2022

If it works we can also try to use it for etcd

// StartProjectRoot starts an etcd server. If projectRoot is not empty, then it checks
// if the .bin/etcd binary exists, and uses that instead of the one in the path.
func StartProjectRoot(projectRoot string) error {

@AlexanderYastrebov AlexanderYastrebov force-pushed the use-test-containers-for-redis-server branch 2 times, most recently from e147bf9 to 4417c1d Compare February 17, 2022 13:55
Mitigates build failures caused by package manager redirects during `redis-server` installation.
Note that change adds many dependencies but they are only used for tests and do not end up in the build.

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
@AlexanderYastrebov AlexanderYastrebov force-pushed the use-test-containers-for-redis-server branch from 4417c1d to aaaff64 Compare February 17, 2022 14:06
ContainerRequest: testcontainers.ContainerRequest{
Image: "redis:6-alpine",
Cmd: args,
ExposedPorts: []string{"6379/tcp"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does a test container gets it's own IP?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gets a mapped port on localhost that we obtain using .Endpoint below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like we could test sharding with this too, but we need to change the port for the next ones :)

@szuecs
Copy link
Member

szuecs commented Feb 17, 2022

Do you also want to add etcd?

@AlexanderYastrebov
Copy link
Member Author

AlexanderYastrebov commented Feb 18, 2022

Do you also want to add etcd?

I thought about doing it in separate PR, this one should fix build failures

@szuecs
Copy link
Member

szuecs commented Feb 18, 2022

👍

@@ -8,8 +8,6 @@ pipeline:
commands:
- desc: build-push
cmd: |
apt-get update -o Acquire::http::AllowRedirect=false
apt-get install -o Acquire::http::AllowRedirect=false -y bzr redis-server jq
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see bzr used anywhere but I think this would break a Makefile that depends on jq

@aryszka
Copy link
Contributor

aryszka commented Feb 18, 2022

👍

@szuecs szuecs merged commit 1a1d1eb into master Feb 18, 2022
@szuecs szuecs deleted the use-test-containers-for-redis-server branch February 18, 2022 11:01
AlexanderYastrebov added a commit that referenced this pull request Feb 18, 2022
`jq` installation was removed by #1960 but it is required by `packaging/Makefile`

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
AlexanderYastrebov added a commit that referenced this pull request Feb 18, 2022
`jq` installation was removed by #1960 but it is required by `packaging/Makefile`

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants