diff options
author | Jaka Hudoklin <jakahudoklin@gmail.com> | 2016-09-27 22:56:58 +0200 |
---|---|---|
committer | Jaka Hudoklin <jakahudoklin@gmail.com> | 2016-10-01 17:08:48 +0200 |
commit | feb9fc3aff07698a01163336613224b08547d65b (patch) | |
tree | 074dd145cdd32aaaff063b431c45567d60acfa4a /nixos/tests | |
parent | eb1377ba304f22dc7bb105b456bd685fd937b18f (diff) | |
download | nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar.gz nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar.bz2 nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar.lz nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar.xz nixlib-feb9fc3aff07698a01163336613224b08547d65b.tar.zst nixlib-feb9fc3aff07698a01163336613224b08547d65b.zip |
flannel service: init
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/flannel.nix | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/nixos/tests/flannel.nix b/nixos/tests/flannel.nix new file mode 100644 index 000000000000..7f27903a3026 --- /dev/null +++ b/nixos/tests/flannel.nix @@ -0,0 +1,55 @@ +import ./make-test.nix ({ pkgs, ...} : rec { + name = "flannel"; + + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ offline ]; + }; + + nodes = let + flannelConfig = { + services.flannel = { + enable = true; + network = "10.1.0.0/16"; + iface = "eth1"; + etcd.endpoints = ["http://etcd:2379"]; + }; + + networking.firewall.allowedUDPPorts = [ 8472 ]; + }; + in { + etcd = { config, pkgs, ... }: { + services = { + etcd = { + enable = true; + listenClientUrls = ["http://etcd:2379"]; + listenPeerUrls = ["http://etcd:2380"]; + initialAdvertisePeerUrls = ["http://etcd:2379"]; + initialCluster = ["etcd=http://etcd:2379"]; + }; + }; + + networking.firewall.allowedTCPPorts = [ 2379 ]; + }; + + node1 = { config, ... }: { + require = [flannelConfig]; + }; + + node2 = { config, ... }: { + require = [flannelConfig]; + }; + }; + + testScript = '' + startAll; + + $node1->waitForUnit("flannel.service"); + $node2->waitForUnit("flannel.service"); + + my $ip1 = $node1->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'"); + my $ip2 = $node2->succeed("ip -4 addr show flannel.1 | grep -oP '(?<=inet).*(?=/)'"); + + $node1->waitUntilSucceeds("ping -c 1 $ip2"); + $node2->waitUntilSucceeds("ping -c 1 $ip1"); + ''; +}) |