From 7d7523a8a20180e5582c43dbeeba4c85cd9dab1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 5 Aug 2020 16:09:24 +0200 Subject: [PATCH] ceph: fix unit test mock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mock the user creation otherwise the health check fails and panics. Closes: https://github.com/rook/rook/issues/5976 Signed-off-by: Sébastien Han --- pkg/operator/ceph/object/controller_test.go | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pkg/operator/ceph/object/controller_test.go b/pkg/operator/ceph/object/controller_test.go index bc50a46ad..7aa88e721 100644 --- a/pkg/operator/ceph/object/controller_test.go +++ b/pkg/operator/ceph/object/controller_test.go @@ -137,6 +137,44 @@ const ( "ceph version 14.2.8 (3a54b2b6d167d4a2a19e003a705696d4fe619afc) nautilus (stable)": 3 } }` + userCreateJSON = `{ + "user_id": "my-user", + "display_name": "my-user", + "email": "", + "suspended": 0, + "max_buckets": 1000, + "subusers": [], + "keys": [ + { + "user": "my-user", + "access_key": "EOE7FYCNOBZJ5VFV909G", + "secret_key": "qmIqpWm8HxCzmynCrD6U6vKWi4hnDBndOnmxXNsV" + } + ], + "swift_keys": [], + "caps": [], + "op_mask": "read, write, delete", + "default_placement": "", + "default_storage_class": "", + "placement_tags": [], + "bucket_quota": { + "enabled": false, + "check_on_raw": false, + "max_size": -1, + "max_size_kb": 0, + "max_objects": -1 + }, + "user_quota": { + "enabled": false, + "check_on_raw": false, + "max_size": -1, + "max_size_kb": 0, + "max_objects": -1 + }, + "temp_url_keys": [], + "type": "rgw", + "mfa_ids": [] +}` ) var ( @@ -309,6 +347,9 @@ func TestCephObjectStoreController(t *testing.T) { if args[0] == "zone" && args[1] == "get" { return zoneGetJSON, nil } + if args[0] == "user" { + return userCreateJSON, nil + } return "", nil }, }