diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-12-15 10:06:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-15 10:06:23 -0800 |
commit | 5687f61b1984edc13e9a6427d9185747e7a540d4 (patch) | |
tree | caf1e6fe761e28c79f976dfd102b868f51c4e46a /nixos/tests | |
parent | 101b4ec5463f64e231dc251ac486562e5a7a952e (diff) | |
parent | 1c870ef3585489670c535eb31d762b19b6bc7ce7 (diff) | |
download | nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar.gz nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar.bz2 nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar.lz nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar.xz nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.tar.zst nixlib-5687f61b1984edc13e9a6427d9185747e7a540d4.zip |
Merge pull request #32637 from makefu/pkgs/openstack/nuke
nuke openstack (again)
Diffstat (limited to 'nixos/tests')
-rw-r--r-- | nixos/tests/glance.nix | 77 | ||||
-rw-r--r-- | nixos/tests/keystone.nix | 82 |
2 files changed, 0 insertions, 159 deletions
diff --git a/nixos/tests/glance.nix b/nixos/tests/glance.nix deleted file mode 100644 index 992b77227a4b..000000000000 --- a/nixos/tests/glance.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ system ? builtins.currentSystem }: - -with import ../lib/testing.nix { inherit system; }; -with pkgs.lib; - -let - glanceMysqlPassword = "glanceMysqlPassword"; - glanceAdminPassword = "glanceAdminPassword"; - - createDb = pkgs.writeText "db-provisionning.sql" '' - create database keystone; - GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone'; - GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone'; - - create database glance; - GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '${glanceMysqlPassword}'; - GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '${glanceMysqlPassword}'; - ''; - - image = - (import ../lib/eval-config.nix { - inherit system; - modules = [ ../../nixos/modules/virtualisation/nova-image.nix ]; - }).config.system.build.novaImage; - - # The admin keystone account - adminOpenstackCmd = "OS_TENANT_NAME=admin OS_USERNAME=admin OS_PASSWORD=keystone OS_AUTH_URL=http://localhost:5000/v3 OS_IDENTITY_API_VERSION=3 openstack"; - -in makeTest { - meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ lewo ]; - }; - machine = - { config, pkgs, ... }: - { - services.mysql.enable = true; - services.mysql.package = pkgs.mysql; - services.mysql.initialScript = createDb; - - virtualisation = { - openstack.keystone = { - enable = true; - database.password = { value = "keystone"; storage = "fromNixStore"; }; - adminToken = { value = "adminToken"; storage = "fromNixStore"; }; - bootstrap.enable = true; - bootstrap.adminPassword = { value = "keystone"; storage = "fromNixStore"; }; - }; - - openstack.glance = { - enable = true; - database.password = { value = glanceMysqlPassword; storage = "fromNixStore"; }; - servicePassword = { value = glanceAdminPassword; storage = "fromNixStore"; }; - - bootstrap = { - enable = true; - keystoneAdminPassword = { value = "keystone"; storage = "fromNixStore"; }; - }; - }; - - memorySize = 2096; - diskSize = 4 * 1024; - }; - - environment.systemPackages = with pkgs.pythonPackages; with pkgs; [ - openstackclient - ]; - }; - - testScript = - '' - $machine->waitForUnit("glance-api.service"); - - # Since Glance api can take time to start, we retry until success - $machine->waitUntilSucceeds("${adminOpenstackCmd} image create nixos --file ${image}/nixos.img --disk-format qcow2 --container-format bare --public"); - $machine->succeed("${adminOpenstackCmd} image list") =~ /nixos/ or die; - ''; -} diff --git a/nixos/tests/keystone.nix b/nixos/tests/keystone.nix deleted file mode 100644 index 358e352f776f..000000000000 --- a/nixos/tests/keystone.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ system ? builtins.currentSystem }: - -with import ../lib/testing.nix { inherit system; }; -with pkgs.lib; - -let - keystoneMysqlPassword = "keystoneMysqlPassword"; - keystoneMysqlPasswordFile = "/var/run/keystoneMysqlPassword"; - keystoneAdminPassword = "keystoneAdminPassword"; - - createKeystoneDb = pkgs.writeText "create-keystone-db.sql" '' - create database keystone; - GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY '${keystoneMysqlPassword}'; - GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY '${keystoneMysqlPassword}'; - ''; - # The admin keystone account - adminOpenstackCmd = "OS_TENANT_NAME=admin OS_USERNAME=admin OS_PASSWORD=${keystoneAdminPassword} OS_AUTH_URL=http://localhost:5000/v3 OS_IDENTITY_API_VERSION=3 openstack"; - # The created demo keystone account - demoOpenstackCmd = "OS_TENANT_NAME=demo OS_USERNAME=demo OS_PASSWORD=demo OS_AUTH_URL=http://localhost:5000/v3 OS_IDENTITY_API_VERSION=3 openstack"; - -in makeTest { - meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ lewo ]; - }; - machine = - { config, pkgs, ... }: - { - # This is to simulate nixops deployment process. - # https://nixos.org/nixops/manual/#opt-deployment.keys - boot.postBootCommands = "echo ${keystoneMysqlPassword} > ${keystoneMysqlPasswordFile}"; - - services.mysql.enable = true; - services.mysql.initialScript = createKeystoneDb; - - virtualisation = { - - openstack.keystone = { - enable = true; - # Check if we can get the secret from a file - database.password = { - value = keystoneMysqlPasswordFile; - storage = "fromFile"; - }; - adminToken = { - value = "adminToken"; - storage = "fromNixStore"; - }; - - bootstrap.enable = true; - # Check if we can get the secret from the store - bootstrap.adminPassword = { - value = keystoneAdminPassword; - storage = "fromNixStore"; - }; - }; - - memorySize = 2096; - diskSize = 4 * 1024; - }; - - environment.systemPackages = with pkgs.pythonPackages; with pkgs; [ - openstackclient - ]; - }; - - testScript = - '' - $machine->waitForUnit("keystone-all.service"); - - # Verify that admin ccount is working - $machine->succeed("${adminOpenstackCmd} token issue"); - - # Try to create a new user - $machine->succeed("${adminOpenstackCmd} project create --domain default --description 'Demo Project' demo"); - $machine->succeed("${adminOpenstackCmd} user create --domain default --password demo demo"); - $machine->succeed("${adminOpenstackCmd} role create user"); - $machine->succeed("${adminOpenstackCmd} role add --project demo --user demo user"); - - # Verify this new account is working - $machine->succeed("${demoOpenstackCmd} token issue"); - ''; -} |