Merge pull request #74070 from mayflower/tests-python-minio

nixosTests.minio: port to python
This commit is contained in:
Florian Klink 2019-11-24 20:32:11 +01:00 committed by GitHub
commit f8117905f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...} : import ./make-test-python.nix ({ pkgs, ...} :
let let
accessKey = "BKIKJAA5BMMU2RHO6IBB"; accessKey = "BKIKJAA5BMMU2RHO6IBB";
secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12"; secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12";
@ -18,7 +18,7 @@ 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')
''; '';
in { in {
name = "minio"; name = "minio";
meta = with pkgs.stdenv.lib.maintainers; { meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ bachp ]; maintainers = [ bachp ];
@ -37,19 +37,19 @@ let
}; };
}; };
testScript = testScript = ''
'' start_all()
startAll; machine.wait_for_unit("minio.service")
$machine->waitForUnit("minio.service"); machine.wait_for_open_port(9000)
$machine->waitForOpenPort(9000);
# Create a test bucket on the server # Create a test bucket on the server
$machine->succeed("mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} S3v4"); machine.succeed(
$machine->succeed("mc mb minio/test-bucket"); "mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} S3v4"
$machine->succeed("${minioPythonScript}"); )
$machine->succeed("mc ls minio") =~ /test-bucket/ or die; machine.succeed("mc mb minio/test-bucket")
$machine->succeed("mc cat minio/test-bucket/test.txt") =~ /Test from Python/ or die; machine.succeed("${minioPythonScript}")
$machine->shutdown; assert "test-bucket" in machine.succeed("mc ls minio")
assert "Test from Python" in machine.succeed("mc cat minio/test-bucket/test.txt")
''; machine.shutdown()
'';
}) })