Fix rotate/config unit test for 32 bit yet again (#11491)

This commit is contained in:
Scott Miller 2021-04-30 10:31:11 -05:00 committed by GitHub
parent 85fbd45e1c
commit fcb9bab51b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -2066,7 +2066,7 @@ func TestSystemBackend_rotateConfig(t *testing.T) {
}
req2 := logical.TestRequest(t, logical.UpdateOperation, "rotate/config")
req2.Data["max_operations"] = int64(2345678910)
req2.Data["max_operations"] = 123456789
req2.Data["interval"] = "5432h0m0s"
req2.Data["enabled"] = false
@ -2081,11 +2081,20 @@ func TestSystemBackend_rotateConfig(t *testing.T) {
}
exp = map[string]interface{}{
"max_operations": int64(2345678910),
"max_operations": 123456789,
"interval": "5432h0m0s",
"enabled": false,
}
// Not pretty, but on a 64-bit machine, the response value is 64-bit, while on a 32 bit machine it'll be an int
// DeepEqual rejects it due to the type difference
if d, ok := resp.Data["max_operations"]; ok {
v, ok := d.(int64)
if ok {
resp.Data["max_operations"] = int(v)
}
}
if !reflect.DeepEqual(resp.Data, exp) {
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
}