nixos/tests/garage: move to runTest
This commit is contained in:
parent
7078acdcdf
commit
722607472a
@ -535,7 +535,10 @@ in
|
||||
mimir = runTest ./mimir.nix;
|
||||
galene = discoverTests (import ./galene.nix);
|
||||
gancio = runTest ./gancio.nix;
|
||||
garage = handleTest ./garage { };
|
||||
garage_1 = import ./garage {
|
||||
inherit runTest;
|
||||
package = pkgs.garage_1_x;
|
||||
};
|
||||
gatus = runTest ./gatus.nix;
|
||||
getaddrinfo = runTest ./getaddrinfo.nix;
|
||||
gemstash = handleTest ./gemstash.nix { };
|
||||
|
||||
@ -1,17 +1,13 @@
|
||||
args@{ mkNode, ver, ... }:
|
||||
(import ../make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
name = "garage-basic";
|
||||
meta = {
|
||||
maintainers = with pkgs.lib.maintainers; [ raitobezarius ];
|
||||
};
|
||||
{ mkNode, ... }:
|
||||
{
|
||||
name = "garage-basic";
|
||||
|
||||
nodes = {
|
||||
single_node = mkNode { replicationMode = "none"; };
|
||||
};
|
||||
nodes = {
|
||||
single_node = mkNode { replicationMode = "none"; };
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
testScript = # python
|
||||
''
|
||||
from typing import List
|
||||
from dataclasses import dataclass
|
||||
import re
|
||||
@ -54,9 +50,7 @@ args@{ mkNode, ver, ... }:
|
||||
machine.succeed(f"garage layout apply --version {version}")
|
||||
|
||||
def create_api_key(machine: Machine, key_name: str) -> S3Key:
|
||||
output = machine.succeed(f"garage key ${
|
||||
if ver == "0_8" then "new --name" else "create"
|
||||
} {key_name}")
|
||||
output = machine.succeed(f"garage key create {key_name}")
|
||||
m = key_creation_regex.match(output)
|
||||
if not m or not m.group('key_id') or not m.group('secret_key'):
|
||||
raise ValueError('Cannot parse API key data')
|
||||
@ -94,13 +88,9 @@ args@{ mkNode, ver, ... }:
|
||||
single_node.wait_for_open_port(3900)
|
||||
# Now Garage is initialized.
|
||||
single_node_id = get_node_id(single_node)
|
||||
apply_garage_layout(single_node, [f'-z qemutest -c ${
|
||||
if ver == "0_8" then "1" else "1G"
|
||||
} "{single_node_id}"'])
|
||||
apply_garage_layout(single_node, [f'-z qemutest -c 1G "{single_node_id}"'])
|
||||
# Now Garage is operational.
|
||||
test_bucket_writes(single_node)
|
||||
test_bucket_over_http(single_node)
|
||||
'';
|
||||
}
|
||||
))
|
||||
args
|
||||
}
|
||||
|
||||
@ -1,13 +1,9 @@
|
||||
{
|
||||
system ? builtins.currentSystem,
|
||||
config ? { },
|
||||
pkgs ? import ../../.. { inherit system config; },
|
||||
runTest,
|
||||
package,
|
||||
}:
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
mkNode =
|
||||
package:
|
||||
{
|
||||
replicationMode,
|
||||
publicV6Address ? "::1",
|
||||
@ -55,24 +51,22 @@ let
|
||||
virtualisation.diskSize = 2 * 1024;
|
||||
};
|
||||
in
|
||||
foldl
|
||||
(
|
||||
matrix: ver:
|
||||
matrix
|
||||
// {
|
||||
"basic${toString ver}" = import ./basic.nix {
|
||||
inherit system pkgs ver;
|
||||
mkNode = mkNode pkgs."garage_${ver}";
|
||||
};
|
||||
"with-3node-replication${toString ver}" = import ./with-3node-replication.nix {
|
||||
inherit system pkgs ver;
|
||||
mkNode = mkNode pkgs."garage_${ver}";
|
||||
};
|
||||
}
|
||||
)
|
||||
{ }
|
||||
[
|
||||
"0_8"
|
||||
"0_9"
|
||||
"1_x"
|
||||
]
|
||||
{
|
||||
basic = runTest {
|
||||
imports = [
|
||||
./basic.nix
|
||||
];
|
||||
_module.args = {
|
||||
inherit mkNode;
|
||||
};
|
||||
};
|
||||
|
||||
with-3node-replication = runTest {
|
||||
imports = [
|
||||
./with-3node-replication.nix
|
||||
];
|
||||
_module.args = {
|
||||
inherit mkNode;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,32 +1,28 @@
|
||||
args@{ mkNode, ver, ... }:
|
||||
(import ../make-test-python.nix (
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
name = "garage-3node-replication";
|
||||
meta = {
|
||||
maintainers = with pkgs.lib.maintainers; [ raitobezarius ];
|
||||
};
|
||||
{ mkNode, ... }:
|
||||
{
|
||||
name = "garage-3node-replication";
|
||||
|
||||
nodes = {
|
||||
node1 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::1";
|
||||
};
|
||||
node2 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::2";
|
||||
};
|
||||
node3 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::3";
|
||||
};
|
||||
node4 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::4";
|
||||
};
|
||||
nodes = {
|
||||
node1 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::1";
|
||||
};
|
||||
node2 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::2";
|
||||
};
|
||||
node3 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::3";
|
||||
};
|
||||
node4 = mkNode {
|
||||
replicationMode = "3";
|
||||
publicV6Address = "fc00:1::4";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
testScript = # python
|
||||
''
|
||||
from typing import List
|
||||
from dataclasses import dataclass
|
||||
import re
|
||||
@ -68,9 +64,7 @@ args@{ mkNode, ver, ... }:
|
||||
machine.succeed(f"garage layout apply --version {version}")
|
||||
|
||||
def create_api_key(machine: Machine, key_name: str) -> S3Key:
|
||||
output = machine.succeed(f"garage key ${
|
||||
if ver == "0_8" then "new --name" else "create"
|
||||
} {key_name}")
|
||||
output = machine.succeed(f"garage key create {key_name}")
|
||||
m = key_creation_regex.match(output)
|
||||
if not m or not m.group('key_id') or not m.group('secret_key'):
|
||||
raise ValueError('Cannot parse API key data')
|
||||
@ -125,7 +119,7 @@ args@{ mkNode, ver, ... }:
|
||||
zones = ["nixcon", "nixcon", "paris_meetup", "fosdem"]
|
||||
apply_garage_layout(node1,
|
||||
[
|
||||
f'{ndata.node_id} -z {zones[index]} -c ${if ver == "0_8" then "1" else "1G"}'
|
||||
f'{ndata.node_id} -z {zones[index]} -c 1G'
|
||||
for index, ndata in enumerate(node_ids.values())
|
||||
])
|
||||
# Now Garage is operational.
|
||||
@ -133,6 +127,4 @@ args@{ mkNode, ver, ... }:
|
||||
for node in nodes:
|
||||
test_bucket_over_http(get_machine(node))
|
||||
'';
|
||||
}
|
||||
))
|
||||
args
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ let
|
||||
"k2v::poll::test_poll_item"
|
||||
];
|
||||
|
||||
passthru.tests = nixosTests.garage;
|
||||
passthru.tests = nixosTests."garage_${lib.versions.major version}";
|
||||
|
||||
meta = {
|
||||
description = "S3-compatible object store for small self-hosted geo-distributed deployments";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user