-
Notifications
You must be signed in to change notification settings - Fork 810
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
feat(monitored deploy): add endpoint to get a list of deployment monitors #3138
feat(monitored deploy): add endpoint to get a list of deployment monitors #3138
Conversation
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; | ||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; | ||
|
||
@ExtendWith(SpringExtension.class) |
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.
@robzienert / @robfletcher I copied this pattern, but I question if we actually should test via the WebMvc
? Perhaps it makes sense to validate that params are annotated correctly, but it seems like a big overhead (vs. testing the methods directly). It also makes the tests slower since a bunch of spring needs to be stood up for this style test
What are your thoughts?
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.
it's a java file in src/test/groovy
FWIW
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.
going to convert it to a simple non-mvc test
mvc.perform(request) | ||
.andExpect(status().is2xxSuccessful()) | ||
.andExpect( | ||
content().json(format("[{'id':'%s','name':'%s'}]", def1.getId(), def1.getName()))); |
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.
there has got to be a better way than format
, feedback appreciated!
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.
in pure Java I don't think so. But it seems like a job for def1
's toString()
ArrayList<DeploymentMonitorDefinition> result = new ArrayList<>(); | ||
|
||
if (monitoredDeployConfigurationProperties != null) { | ||
monitoredDeployConfigurationProperties |
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 streamline this with streams:
if (monitoredDeployConfigurationProperties == null) {
return Collections.emptyList();
}
return monitoredDeployConfigurationProperties
.getDeploymentMonitors()
.stream()
.map(dm -> result.add(new DeploymentMonitorDefinition(dm)))
.collect(Collectors.toList());
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.
thanks, i like it (even though i am not a fan of java streams)
import lombok.Data; | ||
|
||
@Data | ||
public class DeploymentMonitorDefinition { |
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.
same class name but in a different package? This is triggering my anxiety
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 is the "model" for the API... should i call it something else - i don't want return all of the internal stuffs
995c821
to
ea202d9
Compare
…tors Returns the names and ids of registered deployment monitors. This will be used in `deck` to let the user pick a monitor (also need to plumb through `gate`)
ea202d9
to
07cfc99
Compare
expose endpoint from spinnaker/orca#3138
expose endpoint from spinnaker/orca#3138
Returns the names and ids of registered deployment monitors.
This will be used in
deck
to let the user pick a monitor (also need to plumb throughgate
)