mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/tests/ceph-single-node: add ceph rgw dashboard test coverage
This commit is contained in:
@@ -43,6 +43,7 @@ let
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
virtualisation = {
|
||||
memorySize = 2048;
|
||||
emptyDiskImages = [
|
||||
20480
|
||||
20480
|
||||
@@ -92,6 +93,10 @@ let
|
||||
cfg.osd2.name
|
||||
];
|
||||
};
|
||||
rgw = {
|
||||
enable = true;
|
||||
daemons = [ cfg.monA.name ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -196,6 +201,16 @@ let
|
||||
"ceph osd pool delete single-node-other-test single-node-other-test --yes-i-really-really-mean-it",
|
||||
)
|
||||
|
||||
# Bootstrap RGW
|
||||
monA.succeed(
|
||||
"sudo -u ceph mkdir -p /var/lib/ceph/radosgw/ceph-${cfg.monA.name}",
|
||||
"ceph auth get-or-create client.${cfg.monA.name} osd 'allow rwx' mon 'allow rw' > /var/lib/ceph/radosgw/ceph-${cfg.monA.name}/keyring",
|
||||
"chown ceph:ceph /var/lib/ceph/radosgw/ceph-${cfg.monA.name}/keyring",
|
||||
"systemctl start ceph-rgw-${cfg.monA.name}",
|
||||
)
|
||||
monA.wait_for_unit("ceph-rgw-${cfg.monA.name}")
|
||||
monA.wait_for_open_port(7480)
|
||||
|
||||
# Shut down ceph by stopping ceph.target.
|
||||
monA.succeed("systemctl stop ceph.target")
|
||||
|
||||
@@ -206,6 +221,7 @@ let
|
||||
monA.wait_for_unit("ceph-osd-${cfg.osd0.name}")
|
||||
monA.wait_for_unit("ceph-osd-${cfg.osd1.name}")
|
||||
monA.wait_for_unit("ceph-osd-${cfg.osd2.name}")
|
||||
monA.wait_for_unit("ceph-rgw-${cfg.monA.name}")
|
||||
|
||||
# Ensure the cluster comes back up again
|
||||
monA.succeed("ceph -s | grep 'mon: 1 daemons'")
|
||||
@@ -229,6 +245,7 @@ let
|
||||
monA.succeed(
|
||||
"echo 'foo bar baz qux' > /tmp/dashboard_pw",
|
||||
"ceph dashboard ac-user-create admin -i /tmp/dashboard_pw administrator",
|
||||
"ceph dashboard set-rgw-credentials",
|
||||
)
|
||||
|
||||
# Get dashboard auth token
|
||||
@@ -243,6 +260,12 @@ let
|
||||
f"curl --fail -s -H 'Accept: application/vnd.ceph.api.v1.0+json' -H 'Authorization: Bearer {token}' http://localhost:8080/api/health/minimal",
|
||||
))
|
||||
assert health["health"]["status"] == "HEALTH_OK"
|
||||
|
||||
# List daemons via REST API
|
||||
rgw_daemons = json.loads(monA.succeed(
|
||||
f"curl --fail -s -H 'Accept: application/vnd.ceph.api.v1.0+json' -H 'Authorization: Bearer {token}' http://localhost:8080/api/rgw/daemon",
|
||||
))
|
||||
assert rgw_daemons[0]["id"] == "a"
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user