Fix test build

This commit is contained in:
Jeff Mitchell 2018-06-09 18:15:05 -04:00
parent 405bce896c
commit 256a6b2b33

View file

@ -128,7 +128,7 @@ func TestHTTP_Forwarding_Stress(t *testing.T) {
testHTTP_Forwarding_Stress_Common(t, true, 50)
}
func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64) {
func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint32) {
testPlaintext := "the quick brown fox"
testPlaintextB64 := "dGhlIHF1aWNrIGJyb3duIGZveA=="
@ -186,11 +186,14 @@ func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64)
}
//core.Logger().Printf("[TRACE] done mounting transit")
var totalOps uint64
var successfulOps uint64
var key1ver int64 = 1
var key2ver int64 = 1
var key3ver int64 = 1
var totalOps *uint32 = new(uint32)
var successfulOps *uint32 = new(uint32)
var key1ver *int32 = new(int32)
*key1ver = 1
var key2ver *int32 = new(int32)
*key2ver = 1
var key3ver *int32 = new(int32)
*key3ver = 1
var numWorkers *uint32 = new(uint32)
*numWorkers = 50
var numWorkersStarted *uint32 = new(uint32)
@ -199,10 +202,9 @@ func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64)
// This is the goroutine loop
doFuzzy := func(id int, parallel bool) {
var myTotalOps *uint32 = new(uint32)
var mySuccessfulOps *uint32 = new(uint32)
var keyVer *int32 = new(int32)
*keyVer = 1
var myTotalOps uint32
var mySuccessfulOps uint32
var keyVer int32 = 1
// Check for panics, otherwise notify we're done
defer func() {
if err := recover(); err != nil {
@ -391,7 +393,7 @@ func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64)
// Change the min version, which also tests the archive functionality
case "change_min_version":
var latestVersion int64 = keyVer
var latestVersion int32 = keyVer
if parallel {
switch chosenKey {
case "test1":
@ -403,7 +405,7 @@ func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64)
}
}
setVersion := (myRand.Int63() % latestVersion) + 1
setVersion := (myRand.Int31() % latestVersion) + 1
//core.Logger().Printf("[TRACE] %s, %s, %d, new min version %d", chosenFunc, chosenKey, id, setVersion)
@ -429,10 +431,10 @@ func testHTTP_Forwarding_Stress_Common(t *testing.T, parallel bool, num uint64)
// Wait for them all to finish
wg.Wait()
if totalOps == 0 || totalOps != successfulOps {
t.Fatalf("total/successful ops zero or mismatch: %d/%d; parallel: %t, num %d", totalOps, successfulOps, parallel, num)
if *totalOps == 0 || *totalOps != *successfulOps {
t.Fatalf("total/successful ops zero or mismatch: %d/%d; parallel: %t, num %d", *totalOps, *successfulOps, parallel, num)
}
t.Logf("total operations tried: %d, total successful: %d; parallel: %t, num %d", totalOps, successfulOps, parallel, num)
t.Logf("total operations tried: %d, total successful: %d; parallel: %t, num %d", *totalOps, *successfulOps, parallel, num)
}
// This tests TLS connection state forwarding by ensuring that we can use a