Check that ActualSuccess is greater than 0 in ServiceProfiles test (#4384)

#4217 suggests a retries integration test, but this is already tested as part
of the ServiceProfiles test.

In order to fix this issue, an extra check has been added to the assertion of
the `ActualSuccess` value. It now asserts the value is both greater than 0 and
less than 100.

Closes #4217

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
This commit is contained in:
Kevin Leimkuhler 2020-05-14 09:56:39 -07:00 committed by GitHub
parent 115bab9868
commit dc5ca1a754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -175,8 +175,8 @@ func TestServiceProfileMetrics(t *testing.T) {
}
assertRouteStat(testUpstreamDeploy, testNamespace, testDownstreamDeploy, t, func(stat *cmd2.JSONRouteStats) error {
if *stat.ActualSuccess == 100.00 {
return fmt.Errorf("expected Actual Success to be less than 100%% due to pre-seeded failure rate. But got %0.2f", *stat.ActualSuccess)
if !(*stat.ActualSuccess > 0.00 && *stat.ActualSuccess < 100.00) {
return fmt.Errorf("expected Actual Success to be greater than 0%% and less than 100%% due to pre-seeded failure rate. But got %0.2f", *stat.ActualSuccess)
}
return nil
})
@ -212,7 +212,7 @@ func TestServiceProfileMetrics(t *testing.T) {
assertRouteStat(testUpstreamDeploy, testNamespace, testDownstreamDeploy, t, func(stat *cmd2.JSONRouteStats) error {
if *stat.EffectiveSuccess < 0.95 {
return fmt.Errorf("expected Effective Success to be at least 95%% with retries enabled. But got %.2f", *stat.ActualSuccess)
return fmt.Errorf("expected Effective Success to be at least 95%% with retries enabled. But got %.2f", *stat.EffectiveSuccess)
}
return nil
})