You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "wu-sheng (via GitHub)" <gi...@apache.org> on 2023/04/26 12:58:13 UTC

[GitHub] [skywalking-go] wu-sheng commented on a diff in pull request #19: Add the Write Plugin Test documentation

wu-sheng commented on code in PR #19:
URL: https://github.com/apache/skywalking-go/pull/19#discussion_r1177842181


##########
docs/en/development-and-contribution/write-plugin-testing.md:
##########
@@ -1,3 +1,84 @@
 # Write Plugin Test
 
-Currently, this part has not been done yet.
\ No newline at end of file
+Writing plugin test cases can greatly help you determine if your plugin is running well across multiple versions. 
+If you haven't started developing your plugin yet, please read this [Plugin Development Guide](./development-guide.md) first.
+
+Developing a plugin involves the following steps:
+
+1. **Create a new module**: Please create a new module in the [specified directory](../../../test/plugins/scenarios), and it is recommended to name the module the same as the plugin for easy reference.
+2. **Write the configuration file**: This file serves as the declaration file for the plugin, and test cases would be run based on this file.
+3. **Write the test code**: Simulate the actual service operation, including the plugin you want to test.
+4. **Test execution**: Check if the plugin is running properly.
+
+## Write Configuration File
+
+The configuration file is used to define the basic information of the test plugin. 
+You can use [the gin plugin configuration file](../../../test/plugins/scenarios/gin/plugin.yml) as an example to write your own. 
+It includes the following information:
+
+1. **entry-service**: The test HTTP service entry URL. When this address is accessed, the plugin code should be triggered.
+2. **health-checker**: Executed before the **entry-service** is accessed to ensure that the service starts without any issues. Status code of `200` is considered a successful service start.
+3. **start-script**: The script execution file path. Please compile and start the service in this file.
+4. **framework**: The access address of the current framework to be tested. During testing, this address would be used to switch between different framework versions.
+5. **export-port**: The port number for the external service entry.
+6. **support-version**: The version information supported by the current plugin.
+   1. **go**: The supported Golang language version for the current plugin.
+   2. **framework**: A list of plugin version information. It would be used to switch between multiple framework versions.
+
+### URL Access
+
+When the service address is accessed, please use `${HTTP_HOST}` and `${HTTP_PORT}` to represent the domain name and port number to be accessed. 
+The port number corresponds to the **export-port** field.
+
+### Start Script
+
+The startup script is used to compile and execute the program.
+
+When starting, please add the `${GO_BUILD_OPTS}` parameter, which specifies the Go Agent program information for hybrid compilation.
+
+When starting, just let the program keep running.
+
+### Multiple Versions

Review Comment:
   ```suggestion
   ### Version Matrix
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org