Skip to content

Commit

Permalink
fix: rework tests in order to make the dedicated module work without …
Browse files Browse the repository at this point in the history
…replacements
  • Loading branch information
omissis committed Oct 4, 2023
1 parent b0ec161 commit e8a51ed
Show file tree
Hide file tree
Showing 118 changed files with 563 additions and 585 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
version: v1.53.3
args: -v --color=always --config=.rules/.golangci.yml ./...
- name: Run tests
run: go test -v -race -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
run: ./scripts/test.sh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: Build binaries
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
version: v1.53.3
args: -v --color=always --config=.rules/.golangci.yml ./...
- name: Run tests
run: go test -v -race ./...
run: ./scripts/test.sh
- name: Log in to Docker Hub
if: ${{ !contains(github.ref_name, '-') }}
uses: docker/login-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.envrc
.idea
coverage.out
coverage/
bin/
dist/
vendor/
go.work
5 changes: 0 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module github.com/atombender/go-jsonschema
go 1.21

require (
github.com/atombender/go-jsonschema/tests/data v0.0.0-20231004081121-f58c06ae3d14
github.com/goccy/go-yaml v1.11.2
github.com/magiconair/properties v1.8.7
github.com/mitchellh/go-wordwrap v1.0.1
github.com/pkg/errors v0.9.1
github.com/sanity-io/litter v1.5.5
github.com/spf13/cobra v1.7.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand All @@ -23,5 +20,3 @@ require (
golang.org/x/sys v0.12.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
)

replace github.com/atombender/go-jsonschema/tests/data => ./tests/data
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
Expand Down Expand Up @@ -52,7 +50,5 @@ golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 6 additions & 0 deletions go.work.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.21.1

use (
.
./tests
)
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
2 changes: 2 additions & 0 deletions scripts/lint-golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ set -e
set -o errexit -o nounset

golangci-lint -v run --color=always --config=.rules/.golangci.yml ./...
golangci-lint -v run --color=always --config=.rules/.golangci.yml tests/*.go
golangci-lint -v run --color=always --config=.rules/.golangci.yml tests/helpers/*.go
8 changes: 7 additions & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
set -e
set -o errexit -o nounset

go test -v -race -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
mkdir -p "${PWD}/coverage/pkg"
mkdir -p "${PWD}/coverage/tests"

go test -v -race -mod=readonly -covermode=atomic -coverpkg=./... -cover ./... -args -test.gocoverdir="${PWD}/coverage/pkg"
go test -v -race -mod=readonly -covermode=atomic -coverpkg=./... -cover ./tests -args -test.gocoverdir="${PWD}/coverage/tests"

go tool covdata textfmt -i=./coverage/tests,./coverage/pkg -o coverage.out
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"$ref": "#/$defs/Thing"
},
"defInOtherSchema": {
"$ref": "other.json#/$defs/Thing"
"$ref": "../other/other.json#/$defs/Thing"
}
},
"$defs": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"$ref": "#/$defs/Thing"
},
"defInOtherSchema": {
"$ref": "other.json#/$defs/Thing"
"$ref": "../other/other.json#/$defs/Thing"
}
},
"$defs": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 0 additions & 13 deletions tests/data/go.mod

This file was deleted.

4 changes: 0 additions & 4 deletions tests/data/go.sum

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 0 additions & 57 deletions tests/data/miscWithDefaults/cyclicAndRequired2.go

This file was deleted.

34 changes: 0 additions & 34 deletions tests/data/miscWithDefaults/cyclicAndRequired2.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e8a51ed

Please sign in to comment.