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