rpmmd: separate loading of repo definitions from file and add tests

Separate the loading of repo definitions from JSON file from
`LoadRepositories()` to a standalone function
`loadRepositoriesFromFile()`, to make it easy to reuse it in the future.

Add unit tests for `LoadRepositories()` function.

Exclude github.com/osbuild/osbuild-composer/internal/rpmmd/test package
from test coverage. Package with just tests and no other code makes `go
test` to fail. This should be fixed in go 1.17.
See https://github.com/golang/go/issues/27333

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-05-04 14:26:33 +02:00 committed by Ondřej Budai
parent f7f064274a
commit 4c5d4de387
6 changed files with 261 additions and 15 deletions

View file

@ -50,7 +50,7 @@ jobs:
run: $(go env GOPATH)/bin/golangci-lint run --timeout 5m0s
- name: Run unit tests
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./...
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./...
- name: Send coverage to codecov.io
run: bash <(curl -s https://codecov.io/bash)