Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental/long-running tests #163

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const testID = "id"
// Enable long running tests by using cmd line arg,
// Usage: go test ... -args [-enable-long|-enable-go-swagger]
//
// -enable-long: enable spec_test.go:TestIssue18 and messages_test.go:Test_Quality*
// -enable-long: enable messages_test.go:Test_Quality*
// -enable-go-swagger: enable non-regression tests against go-swagger fixtures (validation status) in swagger_test.go:Test_GoSwagger (running about 110 specs...)
//
// If none enabled, these tests are skipped
Expand Down
36 changes: 31 additions & 5 deletions swagger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func init() {
}

func skipNotifyGoSwagger(t *testing.T) {
t.Log("To enable this long running test, use -args -enable-go-swagger in your go test command line")
t.Log("A reduced set of fixtures is set. To enable the full list with a long running test, use -args -enable-go-swagger in your go test command line")
}

// Exercise validate will all tests cases from package go-swagger
Expand All @@ -42,16 +42,42 @@ func skipNotifyGoSwagger(t *testing.T) {
//
// TODO: move this list to a YAML fixture config file
func Test_GoSwaggerTestCases(t *testing.T) {
if !enableGoSwaggerTests {
skipNotifyGoSwagger(t)
t.SkipNow()
}
// A list of test cases which fail on "swagger validate" at spec load time
expectedLoadFailures := map[string]bool{
"fixtures/go-swagger/bugs/342/fixture-342.yaml": false,
"fixtures/go-swagger/bugs/342/fixture-342-2.yaml": true,
}

if !enableGoSwaggerTests {
// this is the reduced test run on CI
skipNotifyGoSwagger(t)

expectedFailures := map[string]bool{
"fixtures/go-swagger/bugs/1010/swagger.yml": true,
"fixtures/go-swagger/bugs/103/swagger.json": true,
"fixtures/go-swagger/bugs/106/swagger.json": true,
"fixtures/go-swagger/bugs/1171/swagger.yaml": true,
"fixtures/go-swagger/bugs/1238/swagger.yaml": true,
"fixtures/go-swagger/bugs/1289/fixture-1289-2.yaml": true,
"fixtures/go-swagger/bugs/1289/fixture-1289.yaml": true,
"fixtures/go-swagger/bugs/193/spec2.json": true,
"fixtures/go-swagger/bugs/195/swagger.json": true,
"fixtures/go-swagger/bugs/248/swagger.json": true,
"fixtures/go-swagger/bugs/249/swagger.json": true,
"fixtures/go-swagger/bugs/342/fixture-342-2.yaml": true,
"fixtures/go-swagger/bugs/342/fixture-342.yaml": true,
"fixtures/go-swagger/bugs/423/swagger.json": true,
"fixtures/go-swagger/bugs/453/swagger.yml": true,
"fixtures/go-swagger/bugs/455/swagger.yml": true,
"fixtures/go-swagger/bugs/628/swagger.yml": true,
"fixtures/go-swagger/bugs/733/swagger.json": false,
}

testGoSwaggerSpecs(t, filepath.Join(".", "fixtures", "go-swagger"), expectedFailures, expectedLoadFailures, true)

return
}

// A list of test cases which fail on "swagger validate"
expectedFailures := map[string]bool{
"fixtures/go-swagger/bugs/1010/swagger.yml": true,
Expand Down
Loading