Debian Codegraph @

test/integration/README.md

raw symbols SCIP
1 # Kube OpenAPI Integration Tests
2
3 ## Running the integration tests
4
5 Within the current directory:
6
7 ```bash
8 $ go test -v .
9 ```
10
11 ## Generating the golden Swagger definition file and API rule violation report
12
13 First, run the generator to create `openapi_generated.go` file which specifies
14 the `OpenAPIDefinition` for each type, and generate the golden API rule
15 violation report file. Note that if you do not pass a report
16 filename (`./testdata/golden.v2.report` in the command below) to let the generator
17 to print API rule violations to the file, the generator will return error to stderr
18 on API rule violations.
19
20 ```bash
21 $ go run ../../cmd/openapi-gen/openapi-gen.go \
22 --output-dir pkg/generated \
23 --output-pkg generated \
24 --output-file openapi_generated.go \
25 --go-header-file ../../boilerplate/boilerplate.go.txt \
26 --report-filename ./testdata/golden.v2.report \
27 ./testdata/custom ./testdata/enumtype ./testdata/listtype ./testdata/maptype ./testdata/structtype ./testdata/dummytype ./testdata/uniontype ./testdata/defaults ./testdata/valuevalidation
28 ```
29 The generated file `pkg/generated/openapi_generated.go` should have been created.
30
31 Next, run the OpenAPI builder to create the Swagger file which includes
32 the definitions. The output file named `golden.v2.json` (or v3) will be output in
33 the current directory.
34
35 ```bash
36 $ go run builder/main.go testdata/golden.v2.json
37 $ go run builder3/main.go testdata/golden.v3.json
38 ```
39
40 ❗NOTE❗: If you've created a new type, make sure you add it in `createWebServices()` in
41 `./builder/main.go`, or the definitions won't be generated.
42
43 ❗NOTE❗: If you've created a new package, make sure you also add it to the
44 `inputDir` in `integration_suite_test.go`.