You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/README.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ When `testinfra.StartTestEnv()` is called, the following actions are performed i
26
26
8.**Start the CSGHub dataset viewer server**: The CSGHub dataset viewer server and its workflows are started.
27
27
9.**Start the CSGHub main API server**: The CSGHub main API server and its workflows are started.
28
28
29
-
That’s all. Note that not all services are started by default. For example, the NATS server or runner server is not started. If you need to test functionality related to these services, be sure to add them to the environment startup function.
29
+
That’s all. All docker containers are started using Testcontainers, so all data will be removed after test done.Note that not all services are started by default. For example, the NATS server or runner server is not started. If you need to test functionality related to these services, be sure to add them to the environment startup function.
30
30
31
31
After the test environment is started, always defer the call to `env.Shutdown(ctx)` to ensure all resources are properly cleaned up.
32
32
@@ -51,7 +51,7 @@ This allows you to differentiate between unit tests and integration tests.
51
51
52
52
### What to Test in Integration Tests
53
53
54
-
Integration tests involve starting multiple services and interacting with real databases (as opposed to database unit tests, which use in-memory or transactional databases and roll back changes after the test). Writing too many integration tests can significantly slow down the testing process, so here are three key suggestions:
54
+
Integration tests involve starting multiple services and save data to database (as opposed to database unit tests, which use in-memory transaction and roll back changes after the test). Writing too many integration tests can significantly slow down the testing process, so here are three key suggestions:
55
55
56
56
1.**Group related actions into single test cases**: For example, basic CRUD operations can be tested in a single test case. However, avoid overloading tests. Separate unrelated actions, such as API and Git operations, into different tests.
57
57
2.**Prioritize the most used features**: Focus on testing the 80% of use cases that are most commonly used in your service. These are the most critical and should not fail.
@@ -62,5 +62,11 @@ Integration tests involve starting multiple services and interacting with real d
62
62
You can also use the test environment to start a temporary test server. To do so, run the following command:
63
63
64
64
```
65
-
go run main.go start-test-env
65
+
make run_test_server
66
+
```
67
+
68
+
To integrate the test server into CSGHub portal, change CSGHUB_PORTAL_STARHUB_BASE_URL env:
69
+
70
+
```
71
+
CSGHUB_PORTAL_STARHUB_BASE_URL=http://localhost:9091 make
0 commit comments