-
Notifications
You must be signed in to change notification settings - Fork 2k
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
kubernetes/conversion_test: use test-builders package #2180
Conversation
} | ||
} | ||
|
||
// TODO convertToServices currently doesn't set swarm.EndpointSpec.Ports |
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.
Added a TODO for this; looks like the conversion doesn't return the ports in the spec for the service
internal/test/builders/service.go
Outdated
@@ -8,15 +8,9 @@ import ( | |||
// Any number of service builder functions can be passed to augment it. | |||
// Currently, only ServiceName is implemented |
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.
internal/test/builders/service.go
Outdated
} | ||
service := &swarm.Service{} | ||
ServiceID("serviceID") | ||
ServiceName("defaultServiceName") |
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 don't understand this part. You call a function that returns a function and then you discard its result, meaning you never call the function returned.
Should be something like
ServiceID("serviceID")(service)
ServiceName("defaultServiceName")(service)
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.
Oh, lol, think I forgot to push a change 😂
o(&s) | ||
} | ||
return s | ||
options := append([]func(*swarm.Service){}, ServiceID(id), ServiceName(name), ServiceImage("image")) |
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.
Appending to an empty slice does not make sense to me. Easier to write as
options := []func(*swarm.Service){ServiceID(id), ServiceName(name), ServiceImage("image")}
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 with @kolyshkin changes 👍
Also rewrite `Service()` to use the available options Signed-off-by: Sebastiaan van Stijn <[email protected]>
2c711f5
to
b80fd0c
Compare
Signed-off-by: Sebastiaan van Stijn <[email protected]>
b80fd0c
to
2d0c10d
Compare
}, | ||
} | ||
service := &swarm.Service{} | ||
defaults := []func(*swarm.Service){ServiceID("serviceID"), ServiceName("defaultServiceName")} |
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.
Actually thinking that we could even remove these defaults; looks like it's currently not used in other locations where the code depends on it being set (which means we could convert this package to something that can be used outside of testing as well
@silvin-lubecki updated; PTAL |
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
also some small changes to the internal/test/builders
relates to #2173