Fix rotate/config unit test for 32 bit yet again (#11491)
This commit is contained in:
parent
85fbd45e1c
commit
fcb9bab51b
|
@ -2066,7 +2066,7 @@ func TestSystemBackend_rotateConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
req2 := logical.TestRequest(t, logical.UpdateOperation, "rotate/config")
|
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["interval"] = "5432h0m0s"
|
||||||
req2.Data["enabled"] = false
|
req2.Data["enabled"] = false
|
||||||
|
|
||||||
|
@ -2081,11 +2081,20 @@ func TestSystemBackend_rotateConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
exp = map[string]interface{}{
|
exp = map[string]interface{}{
|
||||||
"max_operations": int64(2345678910),
|
"max_operations": 123456789,
|
||||||
"interval": "5432h0m0s",
|
"interval": "5432h0m0s",
|
||||||
"enabled": false,
|
"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) {
|
if !reflect.DeepEqual(resp.Data, exp) {
|
||||||
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
|
t.Fatalf("got: %#v expect: %#v", resp.Data, exp)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue