Skip to content

Commit

Permalink
code health: rewrite ext error test skip
Browse files Browse the repository at this point in the history
Use skipIfLess helpers like in other test conditions.

Follows #119
  • Loading branch information
DifferentialOrange committed Dec 13, 2022
1 parent 18855f1 commit d2141b7
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions test_helpers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@ func SkipIfIdSupported(t *testing.T) {
skipIfGreaterOrEqual(t, "id requests", 2, 10, 0)
}

// SkipIfErrorExtendedInfoUnsupported skips test run if Tarantool without
// IPROTO_ERROR (0x52) support is used.
func SkipIfErrorExtendedInfoUnsupported(t *testing.T) {
t.Helper()

skipIfLess(t, "error extended info", 2, 4, 1)
}

// SkipIfErrorMessagePackTypeUnsupported skips test run if Tarantool without
// MP_ERROR type over iproto support is used.
func SkipIfErrorMessagePackTypeUnsupported(t *testing.T) {
t.Helper()

skipIfLess(t, "error type in MessagePack", 2, 10, 0)
}

// CheckEqualBoxErrors checks equivalence of tarantool.BoxError objects.
//
// Tarantool errors are not comparable by nature:
Expand Down Expand Up @@ -180,36 +196,3 @@ func CheckEqualBoxErrors(t *testing.T, expected tarantool.BoxError, actual taran
}
}
}

// SkipIfErrorExtendedInfoUnsupported skips test run if Tarantool without
// IPROTO_ERROR (0x52) support is used.
func SkipIfErrorExtendedInfoUnsupported(t *testing.T) {
t.Helper()

// Tarantool provides extended error info only since 2.4.1 version.
isLess, err := IsTarantoolVersionLess(2, 4, 1)
if err != nil {
t.Fatalf("Could not check the Tarantool version")
}

if isLess {
t.Skip("Skipping test for Tarantool without error extended info support")
}
}

// SkipIfErrorExtendedInfoUnsupported skips test run if Tarantool without
// MP_ERROR type over iproto support is used.
func SkipIfErrorMessagePackTypeUnsupported(t *testing.T) {
t.Helper()

// Tarantool error type over MessagePack supported only since 2.10.0 version.
isLess, err := IsTarantoolVersionLess(2, 10, 0)
if err != nil {
t.Fatalf("Could not check the Tarantool version")
}

if isLess {
t.Skip("Skipping test for Tarantool without support of error type over MessagePack")
t.Skip("Skipping test for Tarantool without error extended info support")
}
}

0 comments on commit d2141b7

Please sign in to comment.