Skip to content

Commit

Permalink
Merge pull request #183 from sawsa307/fix-link-and-cleanup
Browse files Browse the repository at this point in the history
Fix link and cleanup
  • Loading branch information
boredabdel authored Nov 15, 2023
2 parents d38d64a + 53bdea6 commit bdd76c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ make test

To cleanup all tests separately, use the following command from test/:
```
./test/cleanup_all.sh
./test/cleanup-all.sh
```

## Adding a new recipe test

For a new recipe, in addition to its yaml file and REAME.md, it should also include a set of test files to make sure the recipe is functional and up-to-date. In the description section of the pull request, you should also provide the result of `make test` to show your test is passing and is not breaking other tests. See example in [output-example.txt](./test_example/output_example.txt).
For a new recipe, in addition to its yaml file and REAME.md, it should also include a set of test files to make sure the recipe is functional and up-to-date. In the description section of the pull request, you should also provide the result of `make test` to show your test is passing and is not breaking other tests. See example in [output-example.txt](./test-example/output-example.txt).
If you are the first one adding tests to a component directory, make sure the directory is included in the testFilePaths in [recipe_test.go](./recipe_test.go)

A recipe directory should have the following layout:
```
Expand All @@ -95,6 +96,6 @@ gke-networking-recipes/

Note that the files have to be named in the exact way to be picked up by the [test framework](recipe_test.go). If any of the test files is missing, it would be skipped by the framework.

You should validate your test passes by following instruction from `Running tests locally`. When creating a new test, you can utilize the helper functions defined in the [helper functions library](./helper.sh). You can find examples for each test file in the [test_example](./test_example/). In general, each test should contain at least one `check_http_status` call in its run-test.sh to validate the traffic.
You should validate your test passes by following instruction from `Running tests locally`. When creating a new test, you can utilize the helper functions defined in the [helper functions library](./helper.sh). You can find examples for each test file in the [test-example](./test-example/). In general, each test should contain at least one `check_http_status` call in its run-test.sh to validate the traffic.

For additional helper functions, please submit a feature request or raise a pull request with example.
File renamed without changes.
9 changes: 5 additions & 4 deletions test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func TestMain(m *testing.M) {
}
project := ph.AcquireOrDie(flags.boskosResourceType)
defer func() {
out, err := exec.Command("bash", "test/cleanup-all.sh").CombinedOutput()
if err != nil {
// Fail now because we shouldn't continue testing if any step fails.
klog.Errorf("failed to run ./test/cleanup-all.sh: %q, err: %v", out, err)
}
ph.Release()
}()

Expand Down Expand Up @@ -79,7 +84,3 @@ func TestMain(m *testing.M) {

m.Run()
}

func TestHelloWorld(t *testing.T) {
klog.Info("Hello world")
}

0 comments on commit bdd76c0

Please sign in to comment.