Skip to content

Commit

Permalink
add: Payload-Digest checks for DisableIPv4 / IPv6 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinB committed Sep 24, 2024
1 parent 63d6404 commit 5ba930f
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@ func TestHTTPClientWithIPv4Disabled(t *testing.T) {
if err != nil {
t.Fatalf("Unable to init WARC writing HTTP client: %s", err)
}
defer httpClient.Close()

// Try IPv4 - should fail
_, err = httpClient.Get(ipv4URL)
Expand All @@ -1346,6 +1345,17 @@ func TestHTTPClientWithIPv4Disabled(t *testing.T) {
if string(body) != "IPv6 Server" {
t.Fatalf("Unexpected response from IPv6 server: %s", string(body))
}

httpClient.Close()

files, err := filepath.Glob(rotatorSettings.OutputDirectory + "/*")
if err != nil {
t.Fatal(err)
}

for _, path := range files {
testFileSingleHashCheck(t, path, "sha1:RTK62UJNR5UCIPX2J64LMV7J4JJ6EXCJ", []string{"147"}, 1)
}
}

func TestHTTPClientWithIPv6Disabled(t *testing.T) {
Expand All @@ -1369,7 +1379,6 @@ func TestHTTPClientWithIPv6Disabled(t *testing.T) {
if err != nil {
t.Fatalf("Unable to init WARC writing HTTP client: %s", err)
}
defer httpClient.Close()

// Try IPv6 - should fail
_, err = httpClient.Get(ipv6URL)
Expand All @@ -1388,6 +1397,17 @@ func TestHTTPClientWithIPv6Disabled(t *testing.T) {
if string(body) != "IPv4 Server" {
t.Fatalf("Unexpected response from IPv4 server: %s", string(body))
}

httpClient.Close()

files, err := filepath.Glob(rotatorSettings.OutputDirectory + "/*")
if err != nil {
t.Fatal(err)
}

for _, path := range files {
testFileSingleHashCheck(t, path, "sha1:JZIRQ2YRCQ55F6SSNPTXHKMDSKJV6QFM", []string{"147"}, 1)
}
}

func BenchmarkConcurrentUnder2MB(b *testing.B) {
Expand Down

0 comments on commit 5ba930f

Please sign in to comment.