nixosTests/minio: make sure editing root credentials restarts minio
This commit is contained in:
parent
e30469a37b
commit
4400f7d72f
|
@ -18,6 +18,14 @@ let
|
||||||
sio.seek(0)
|
sio.seek(0)
|
||||||
minioClient.put_object('test-bucket', 'test.txt', sio, sio_len, content_type='text/plain')
|
minioClient.put_object('test-bucket', 'test.txt', sio, sio_len, content_type='text/plain')
|
||||||
'';
|
'';
|
||||||
|
rootCredentialsFile = "/etc/nixos/minio-root-credentials";
|
||||||
|
credsPartial = pkgs.writeText "minio-credentials-partial" ''
|
||||||
|
MINIO_ROOT_USER=${accessKey}
|
||||||
|
'';
|
||||||
|
credsFull = pkgs.writeText "minio-credentials-full" ''
|
||||||
|
MINIO_ROOT_USER=${accessKey}
|
||||||
|
MINIO_ROOT_PASSWORD=${secretKey}
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
name = "minio";
|
name = "minio";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
|
@ -28,10 +36,7 @@ in {
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
services.minio = {
|
services.minio = {
|
||||||
enable = true;
|
enable = true;
|
||||||
rootCredentialsFile = pkgs.writeText "minio-credentials" ''
|
inherit rootCredentialsFile;
|
||||||
MINIO_ROOT_USER=${accessKey}
|
|
||||||
MINIO_ROOT_PASSWORD=${secretKey}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
environment.systemPackages = [ pkgs.minio-client ];
|
environment.systemPackages = [ pkgs.minio-client ];
|
||||||
|
|
||||||
|
@ -41,7 +46,15 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
import time
|
||||||
|
|
||||||
start_all()
|
start_all()
|
||||||
|
# simulate manually editing root credentials file
|
||||||
|
machine.wait_for_unit("multi-user.target")
|
||||||
|
machine.copy_from_host("${credsPartial}", "${rootCredentialsFile}")
|
||||||
|
time.sleep(3)
|
||||||
|
machine.copy_from_host("${credsFull}", "${rootCredentialsFile}")
|
||||||
|
|
||||||
machine.wait_for_unit("minio.service")
|
machine.wait_for_unit("minio.service")
|
||||||
machine.wait_for_open_port(9000)
|
machine.wait_for_open_port(9000)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue