From fcb9bab51b6de1e2d7362b09b8105007a166c114 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Fri, 30 Apr 2021 10:31:11 -0500 Subject: [PATCH] Fix rotate/config unit test for 32 bit yet again (#11491) --- vault/logical_system_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vault/logical_system_test.go b/vault/logical_system_test.go index f92e8bd24..e9cabdb4f 100644 --- a/vault/logical_system_test.go +++ b/vault/logical_system_test.go @@ -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) }