-
Notifications
You must be signed in to change notification settings - Fork 34
Restii #177
base: master
Are you sure you want to change the base?
Restii #177
Conversation
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 for contributing to the community. This is a good first work.
@@ -108,7 +111,8 @@ public String createMacRange(MacRange macRange) { | |||
public void test_index() throws Exception { | |||
this.mockMvc.perform(get("/start.html")) | |||
.andDo(print()) | |||
.andExpect(status().isOk()); | |||
.andExpect(status().isOk()) | |||
.andDo(document("start")); |
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 use "mac_range_post"?
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 corresponds to the directory name of the generated document. I think the name and the request are the same for easy search. I can change it if necessary, but it cannot conflict with other requests, otherwise it will overwrite the file
import static com.github.tomakehurst.wiremock.client.WireMock.*; | ||
import static org.assertj.core.api.Assertions.*; | ||
|
||
@RunWith(SpringRunner.class) | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, | ||
properties = {"httpbin=http://localhost:${wiremock.server.port}"}) | ||
@AutoConfigureWireMock(port = 0) | ||
@AutoConfigureRestDocs(outputDir = "target/generated-snippets") |
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 most of the 126 files on the other PR could be found in the target/generated-snippets directory, that would be great. This means that we could safely remove those files in the /docs/apis/ directory as we could always find the latest by running "mvn test". right?
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.
Quick question: are we able to find the html files like alcor/docs/apis/mac-manager/swagger/html/index.html in the target/generated-snippets directory?
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.
-
Yes, we can generate those files under the target / generated-snippets directory by executing mvn test
-
The code for the swagger part has not been submitted. Currently, Swagger documentation can be viewed by visiting the /swagger-ui.html path after the microservice is started. Before, I used a separate html generated by a third-party tool. I tried to generate html automatically when I tried mvn test.
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.
Cool! How can we access the /swagger-ui.html if the microservice is not started?
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 found some ways to generate swagger html files during mvn test, I am now verifying
@@ -87,6 +87,17 @@ | |||
<version>0.1.0-SNAPSHOT</version> | |||
<scope>compile</scope> | |||
</dependency> | |||
<dependency> |
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.
We just merged new UTs to VPC and Route Controllers. Could you please add the docs accordingly. Thank you.
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.
Ok let me add it
Now there is a problem, most microservices mvn test need to connect to the database, I currently deploy the database can be executed, but it is best to be able to leave the database
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.
Is it possible to have a flag which could switch off DB access when generating the docs?
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.
The document is generated after the unit test is completed. As long as the unit test does not depend on the database during execution, the document can be generated.
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 see. Please work with @chenpiaoping to see if we can support DB-related UTs by Ignite mock.
[document] Apis - auto genrate Rest API docs (#150)(#176)
Add api-gateway, mac-manager,subnet-manager,privateip-manger Spring REST Docs generated code