tests: use go's test framework in osbuild-dnf-json-tests
This allows us to take advantage of the `testing` package. It also gives the resulting test binary common command line arguments (same as `go test`). Tests need to be compiled with `go test -c`, which injects a `Main()` that calls the Test* functions. This is not supported by the golang rpm macros. Thus, build this binary by calling `go test -c` directly, but taking care to pass the same linker flags as the `%gobuild` macro. Mark the test binary with the `integration` build constraint, so that `go test ./...` doesn't pick them up. That's only for unit tests. The idea is to move all other test binaries to this scheme as well. Spec file changes by Lars Karlitski <lars@karlitski.net>
This commit is contained in:
parent
4a0fea8b6d
commit
bd46389059
3 changed files with 27 additions and 27 deletions
2
Makefile
2
Makefile
|
|
@ -9,7 +9,7 @@ build:
|
|||
go build -o osbuild-upload-aws ./cmd/osbuild-upload-aws/
|
||||
go build -o osbuild-tests ./cmd/osbuild-tests/
|
||||
go build -o osbuild-weldr-tests ./cmd/osbuild-weldr-tests/
|
||||
go build -o osbuild-dnf-json-tests ./cmd/osbuild-dnf-json-tests/
|
||||
go test -c -tags=integration -o osbuild-dnf-json-tests ./cmd/osbuild-dnf-json-tests/main_test.go
|
||||
go build -o osbuild-rcm-tests ./cmd/osbuild-rcm-tests/
|
||||
|
||||
.PHONY: install
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue