Skip to content

Commit 9c82e8e

Browse files
authored
fix unit tests after changed verifyconnection's default to false (#25)
1 parent d1517e0 commit 9c82e8e

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

splunk_test.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ func TestInlineFormatWithNonDefaultOptions(t *testing.T) {
364364
t.Fatal(err)
365365
}
366366

367-
if !hec.connectionVerified {
368-
t.Fatal("By default connection should be verified")
367+
if hec.connectionVerified {
368+
t.Fatal("By default connection should not be verified")
369369
}
370370

371371
splunkLoggerDriver, ok := loggerDriver.(*splunkLoggerInline)
@@ -464,8 +464,8 @@ func TestJsonFormat(t *testing.T) {
464464
t.Fatal(err)
465465
}
466466

467-
if !hec.connectionVerified {
468-
t.Fatal("By default connection should be verified")
467+
if hec.connectionVerified {
468+
t.Fatal("By default connection should not be verified")
469469
}
470470

471471
splunkLoggerDriver, ok := loggerDriver.(*splunkLoggerJSON)
@@ -581,8 +581,8 @@ func TestRawFormat(t *testing.T) {
581581
t.Fatal(err)
582582
}
583583

584-
if !hec.connectionVerified {
585-
t.Fatal("By default connection should be verified")
584+
if hec.connectionVerified {
585+
t.Fatal("By default connection should not be verified")
586586
}
587587

588588
splunkLoggerDriver, ok := loggerDriver.(*splunkLoggerRaw)
@@ -695,8 +695,8 @@ func TestRawFormatWithLabels(t *testing.T) {
695695
t.Fatal(err)
696696
}
697697

698-
if !hec.connectionVerified {
699-
t.Fatal("By default connection should be verified")
698+
if hec.connectionVerified {
699+
t.Fatal("By default connection should not be verified")
700700
}
701701

702702
splunkLoggerDriver, ok := loggerDriver.(*splunkLoggerRaw)
@@ -807,8 +807,8 @@ func TestRawFormatWithoutTag(t *testing.T) {
807807
t.Fatal(err)
808808
}
809809

810-
if !hec.connectionVerified {
811-
t.Fatal("By default connection should be verified")
810+
if hec.connectionVerified {
811+
t.Fatal("By default connection should not be verified")
812812
}
813813

814814
splunkLoggerDriver, ok := loggerDriver.(*splunkLoggerRaw)
@@ -942,8 +942,8 @@ func TestBatching(t *testing.T) {
942942
}
943943
}
944944

945-
// 1 to verify connection and 16 batches
946-
if hec.numOfRequests != 17 {
945+
// 16 batches
946+
if hec.numOfRequests != 16 {
947947
t.Fatalf("Unexpected number of requests %d", hec.numOfRequests)
948948
}
949949

@@ -1089,8 +1089,8 @@ func TestOneMessagePerRequest(t *testing.T) {
10891089
}
10901090
}
10911091

1092-
// 1 to verify connection and 10 messages
1093-
if hec.numOfRequests != 11 {
1092+
// 10 messages
1093+
if hec.numOfRequests != 10 {
10941094
t.Fatalf("Unexpected number of requests %d", hec.numOfRequests)
10951095
}
10961096

@@ -1124,8 +1124,9 @@ func TestVerify(t *testing.T) {
11241124

11251125
info := logger.Info{
11261126
Config: map[string]string{
1127-
splunkURLKey: hec.URL(),
1128-
splunkTokenKey: hec.token,
1127+
splunkURLKey: hec.URL(),
1128+
splunkTokenKey: hec.token,
1129+
splunkVerifyConnectionKey: "true",
11291130
},
11301131
ContainerID: "containeriid",
11311132
ContainerName: "/container_name",

0 commit comments

Comments
 (0)