-
Notifications
You must be signed in to change notification settings - Fork 24
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
ROX-24840 Docker client API for integration tests #1792
Conversation
303fd23
to
c91ddd9
Compare
73b94a1
to
11ee219
Compare
|
97e55a2
to
3736de1
Compare
f175c0c
to
f7e621e
Compare
409137b
to
c436b09
Compare
74ef8a0
to
8e430ba
Compare
c436b09
to
8265dbe
Compare
5d02290
to
233552d
Compare
74053b3
to
4c7d4f0
Compare
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.
Quite a bit of comments, but nothing major. The change is looking great!
integration-tests/pkg/log/logging.go
Outdated
if l.level <= WarnLevel { | ||
l.logger.Printf("WARN: "+format, v...) | ||
} |
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.
Could we move some of this logic into the Log
method?
if l.level <= WarnLevel { | |
l.logger.Printf("WARN: "+format, v...) | |
} | |
l.Log(WarnLevel, format, v...) |
Then the log method can look something like this:
func (l *Logger) Log(level LogLevel, format string, v ...interface{}) {
if level < l.level {
return
}
// Maybe this next part can be done with a const array? Haven't checked.
switch level {
case TraceLevel:
l.logger.Print("TRACE: ")
case DebugLevel:
l.logger.Print("DEBUG: ")
...
}
l.logger.Printf(format, v...)
}
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.
While reading some other parts of the code I noticed the log messages need to add a line manually, we might want to ensure a newline is added in here so we don't have to worry about it in other places of the code.
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 suggestion. I refactored the logging code and removed the extra newlines
authConfigs := map[string]string{} | ||
auths, err := readRegistryConfigs() | ||
if err != nil { | ||
log.Error("Error reading registry auth files: %s", err) |
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.
Should we stop execution at this point? I now right now we have images on private registries that required authentication, so tests will just fail if we keep executing.
log.Error("Error reading registry auth files: %s", err) | |
return nil, log.Error("Error reading registry auth files: %s", err) |
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.
I changed the registry login to only occur if we pull the image which reduces the calls to registry login and as a side effect allows the tests to operate in situations where all the images are local and registry creds are not needed.
|
||
func (d *dockerAPIExecutor) StartContainer(startConfig config.ContainerStartConfig) (string, error) { | ||
ctx := context.Background() | ||
defer d.client.Close() |
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.
Will this close the client when this method ends or once the *dockerAPIExecutor
goes out of scope? If the first is true, will other calls to StartContainer
fail? If it's the second one, is it even needed?
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.
This question applies to all places where this same line is found.
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.
Yeah it isn't necessary. I don't think it closes the client, just closes the existing connections. I've removed calls to it.
4ea6a82
to
aebefef
Compare
018a0f37a Add basic logging utility 4a33e95de mv 3ae29dcdd using log pkg for sleep msg 8265dbe tail collector logs on non-zero exit 422120b Remove K8sExecutor from Executor interface 9da606d [wip] docker client update f542804 docker client file 68fb0e9 benchmark 7cee1bb config 4d0a62c no retry on inspect for pull f97710d Include entrypoint ed4f05a Add PullImage from Giles 786fc87 PullImage wrapper 0011133 refactor, simplify f3e9696 fmt 11b1f8d plop entrypoint bf82e49 use docker-api by default, control with env CONTAINER_EXECUTOR 83a321a debug and trim logs 741b98f copy multiplexed output ff7d92e remove tmp from collector 4fb34b6 tidy, rename 2f6494d simplify 17f7232 debug 54eeb27 debug mounts 1ba6f48 revert debugging 0b6e922 bind mounts only 03e27d2 check image path for auth 5cd9384 Fix container logs, improve auth 58761f5 cleanup 9688f1f correct rebase 623ddd5 add priv c302fa8 fixup 484e081 simplify 32f649d remove docker process executor 5d0a427 fix c396093 map 9b9802a skip podman install 653f188 update ansible podman for rhcos 5365aa3 print collector logs on error 0666f8f update logging 5d02290 update 2ec3a15 add dockerized make test targets 233552d format 4c7d4f0 remove extra step 3636c89 warn 6b37086 invert
aebefef
to
7c2e7f7
Compare
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.
LGTM! There's just one sleep that needs to be removed before merging.
Description
Refactor integration tests from using docker process execution to using the docker engine API.
K8sNamespaceTestSuite
no longer inherits from theBaseIntegrationTestSuite
.ContainerStartConfig
) rather than command line args-dockerized
test targets in the integration-test makefile, e.g.make -C integration-tests TestProcessNetwork-dockerized
Logging example
Checklist
Automated testing
- [ ] Added unit tests- [ ] Added regression testsIf any of these don't apply, please comment below.
Testing Performed
checked logs