-
Notifications
You must be signed in to change notification settings - Fork 63
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
Enhance the code to support to use as container engine podman for e2e #473
base: main
Are you sure you want to change the base?
Conversation
cmoulliard
commented
Jan 6, 2025
- Enhanced the code to support to use as container engine podman and not only docker for 2e2
- Issue: Support to run the e2e test cases using podman #472
…t only docker for 2e2 Signed-off-by: cmoulliard <[email protected]>
/e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we actually run this in GHA, we are doubling the time required to run all tests. We just need to be mindful when enabling it in the workflows.
tests/e2e/docker/docker_test.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a new package just for podman instead of mixing docker and podman? Commands are very similar so you can abstract and re-use them in podman. Every time there's a slight differences between docker and podman, we have to do things like this if os.Getenv("CONTAINER_ENGINE") == "podman" {
. I'd rather branch earlier.
Why do you want to do that ? This change only allows to run the tests using as engine docker or podman and should not require to run both engines. |
… case Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
…r podman clients Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
/e2e |
e2e tests succeeded using either podman or docker |
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
/e2e |
Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
Signed-off-by: cmoulliard <[email protected]>
What do you think if we do this small improvement ?
|
…mplementing the interface exist Signed-off-by: cmoulliard <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to worry about running e2e tests in parallel? By default tests run parallel across multiple packages.
We might end up in a situation where you are running podman and docker tests at the same time using the same port. This will result in failures.
RunIdpCommand(ctx context.Context, cmd string, timeout time.Duration) ([]byte, error) | ||
RunCommand(ctx context.Context, cmd string, timeout time.Duration) ([]byte, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature is exactly the same. Why can't we use RunCommand
? If you need env vars to be set, you can update the function to take a map that defines env vars.
If we do that, we don't need this interface because we can just use the function as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. By the way there is a difference as RunCommand is used to rung the container engine cmd (podman pusll, podman push, etc) why RunIdpCommand is used to run IDP command: idp create, etc
Note: See my comment where I proposed to move RunIdpCommand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, introducing interfaces is not necessary for two engines. Makes it a bit more difficult to read for beginners. Function calls are sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't use an interface then how would you like that we accommodate within the e2e go file and this function
func TestCreateCluster(t *testing.T, containerEngine container.Engine) {
...
the access to the method runIdpCommand
or runCommand
no matter which engine is used: podman or docker
...
t.Log("running idpbuilder create")
b, err := containerEngine.RunIdpCommand(ctx, fmt.Sprintf("%s create --recreate", IdpbuilderBinaryLocation), 0)
assert.NoError(t, err, fmt.Sprintf("error while running create: %s, %s", err, b))
This is not something that we are doing now. We can address such a need in a separate future PR |
You are right that we are not doing this right now because we only have one package. With this change we have two packages. By default, tests in different packages run in parallel. If we have two packages that need to bind to the same port, it's not good. So all I am saying is we need to make sure we test this well and make sure we don't break E2E. |
Signed-off-by: cmoulliard <[email protected]>
What do you then suggest that we do as configuring a machine able to run podman and docker engines at the same time for // tests is quite difficult and will never happen. until ow on github workflow as podman cannot yet run there ? |
The GHA image we use come with both podman and docker. They both work out of the box, as far as I know. I have docker and podman installed on my workstation and they work fine too. https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md What we need to do is make sure we don't run these tests in parallel to avoid host port contentions. Looking at the Makefile, we might be ok but we need to test. |