Skip to content

Commit

Permalink
customizable severity levels (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenharrison authored Jul 18, 2024
1 parent 3fd2ca2 commit 73a0f92
Show file tree
Hide file tree
Showing 32 changed files with 727 additions and 542 deletions.
6 changes: 5 additions & 1 deletion checker/check_api_deprecation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ func getDeprecationFile(file string) string {
}

func singleCheckConfig(c checker.BackwardCompatibilityCheck) *checker.Config {
return checker.NewConfig().WithSingleCheck(c)
return checker.NewConfig(checker.BackwardCompatibilityChecks{c}).WithSingleCheck(c)
}

func allChecksConfig() *checker.Config {
return checker.NewConfig(checker.GetAllChecks())
}

// BC: deleting an operation after sunset date is not breaking
Expand Down
36 changes: 18 additions & 18 deletions checker/check_breaking_min_max_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestBreaking_RequestMaxLengthSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
require.Len(t, errs, 1)
require.Equal(t, checker.RequestParameterMaxLengthDecreasedId, errs[0].GetId())
Expand All @@ -41,7 +41,7 @@ func TestBreaking_ResponseMaxLengthSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -55,7 +55,7 @@ func TestBreaking_RequestMinLengthSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -69,7 +69,7 @@ func TestBreaking_MinLengthSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Equal(t, checker.ResponseBodyMinLengthDecreasedId, errs[0].GetId())
}

Expand All @@ -86,7 +86,7 @@ func TestBreaking_RequestMaxLengthGreater(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -103,7 +103,7 @@ func TestBreaking_ResponseMaxLengthGreater(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
}

Expand All @@ -119,7 +119,7 @@ func TestBreaking_MaxLengthFromNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
require.Len(t, errs, 1)
require.Equal(t, checker.RequestParameterMaxLengthSetId, errs[0].GetId())
Expand All @@ -137,7 +137,7 @@ func TestBreaking_ResponseMaxLengthFromNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -153,7 +153,7 @@ func TestBreaking_RequestMaxLengthToNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -169,7 +169,7 @@ func TestBreaking_ResponseMaxLengthToNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
require.Len(t, errs, 1)
require.Equal(t, checker.ResponseBodyMaxLengthUnsetId, errs[0].GetId())
Expand All @@ -185,7 +185,7 @@ func TestBreaking_MaxLengthBothNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -199,7 +199,7 @@ func TestBreaking_ResponseMaxLengthBothNil(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -213,7 +213,7 @@ func TestBreaking_RequestMinItemsSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -227,7 +227,7 @@ func TestBreaking_ResponseMinItemsSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
require.Len(t, errs, 1)
require.Equal(t, checker.ResponseBodyMinItemsDecreasedId, errs[0].GetId())
Expand All @@ -243,7 +243,7 @@ func TestBreaking_RequeatMinItemsGreater(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
}

Expand All @@ -257,7 +257,7 @@ func TestBreaking_ResponseMinItemsGreater(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}

Expand All @@ -274,7 +274,7 @@ func TestBreaking_MaxSmaller(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.NotEmpty(t, errs)
}

Expand All @@ -291,6 +291,6 @@ func TestBreaking_MaxSmallerInResponse(t *testing.T) {

d, osm, err := diff.GetWithOperationsSourcesMap(diff.NewConfig(), s1, s2)
require.NoError(t, err)
errs := checker.CheckBackwardCompatibility(checker.NewConfig(), d, osm)
errs := checker.CheckBackwardCompatibility(allChecksConfig(), d, osm)
require.Empty(t, errs)
}
Loading

0 comments on commit 73a0f92

Please sign in to comment.