@@ -30,6 +30,7 @@ import (
3030 "time"
3131
3232 driver "github.com/arangodb/go-driver"
33+ "strings"
3334)
3435
3536func checkEnabled (t * testing.T , c driver.Client , ctx context.Context ) {
@@ -193,16 +194,15 @@ func TestServerStatisticsTraffic(t *testing.T) {
193194 // Now check if user only stats are there and see if they should have increased:
194195 if statsBefore .ClientUser .BytesReceived .Counts != nil {
195196 t .Logf ("New user only statistics API is present, testing..." )
196- auth := os .Getenv ("TEST_AUTHENTICATION" )
197- if auth == "super:testing" {
198- t .Logf ("Authentication %s is jwt superuser, expecting no user traffic..." , auth )
197+ if strings .HasPrefix (os .Getenv ("TEST_AUTHENTICATION" ), "super:" ) {
198+ t .Logf ("Authentication %s is jwt superuser, expecting no user traffic..." , os .Getenv ("TEST_AUTHENTICATION" ))
199199 // Traffic is superuser, so nothing should be counted in ClientUser,
200200 // not even the statistics calls.
201201 checkTrafficAtMost (t , & statsBefore , & statsAfter , user ,
202202 & limits {Sent : 0.1 , Recv : 0.1 ,
203203 SentCount : 0 , RecvCount : 0 }, "Cherry" )
204204 } else {
205- t .Logf ("Authentication %s is not jwt superuser, expecting to see user traffic..." , auth )
205+ t .Logf ("Authentication %s is not jwt superuser, expecting to see user traffic..." , os . Getenv ( "TEST_AUTHENTICATION" ) )
206206 // Traffic is either unauthenticated or with password, so there should
207207 // be traffic in ClientUser
208208 checkTrafficAtLeast (t , & statsBefore , & statsAfter , user ,
@@ -246,7 +246,7 @@ func TestServerStatisticsForwarding(t *testing.T) {
246246 endpoints := conn .Endpoints ()
247247
248248 if len (endpoints ) < 2 {
249- t .Fatalf ("Did not have at least two endpoints. Giving up." )
249+ t .Skipf ("Did not have at least two endpoints. Giving up." )
250250 }
251251
252252 // Do a preliminary test to see if we can do some traffic on one coordinator
@@ -348,8 +348,7 @@ func TestServerStatisticsForwarding(t *testing.T) {
348348 // However, first coordinator should have counted the user traffic,
349349 // note: it was just a single request with nearly no upload but quite
350350 // some download:
351- auth := os .Getenv ("TEST_AUTHENTICATION" )
352- if auth != "super:testing" {
351+ if ! strings .HasPrefix (os .Getenv ("TEST_AUTHENTICATION" ), "super:" ) {
353352 t .Logf ("Checking user traffic on coordinator1..." )
354353 t .Logf ("statsBefore1: %v\n statsAfter1: %v" , statsBefore1 .ClientUser .BytesSent , statsAfter1 .ClientUser .BytesSent )
355354 checkTrafficAtLeast (t , & statsBefore1 , & statsAfter1 , user ,
0 commit comments