Skip to content

Commit

Permalink
switch integration tests to use NixOS module
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Jul 11, 2023
1 parent ff5d6a5 commit b692c75
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 56 deletions.
5 changes: 0 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
before_script:
- cp -v $BUILD_CONFIG_FILE_PREVIEW_YAML config/preview.yaml
- cp -v $BUILD_CONFIG_FILE_PREPROD_YAML config/preprod.yaml
- cp -v $BUILD_CONFIG_FILE_MAINNET_YAML config/mainnet.yaml

stages:
- prebuild
- build
Expand Down
89 changes: 38 additions & 51 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ let
testing = import (pkgs.path + "/nixos/lib/testing-python.nix") { inherit system; };
packageJSON = builtins.fromJSON (builtins.readFile ./package.json);

# Use this if you want to override config/default.yaml
/*
blockfrost-backend-test-config = pkgs.writeText "default.yaml" ''
server:
port: 3000
debug: true
dbSync:
host: "cdbsync-testnet.mydomain.com"
user: "cexplorer"
database: "cdbsync"
network: "mainnet"
tokenRegistryUrl: "https://tokens.cardano.org"
'';
*/

blockfrost-backend-ryo =
let
src = pkgs.lib.cleanSource ./.;
Expand Down Expand Up @@ -77,23 +62,23 @@ in
name = "blockfrost-backend-ryo-test-mainnet";

nodes.machine = {
imports = [ ./nixos-module.nix ];
# We have to increase memsize, otherwise we will get error:
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom"
virtualisation.memorySize = 4096;
# Backend service
systemd.services.blockfrost-backend-ryo = {
wantedBy = [ "multi-user.target" ];
script = "${blockfrost-backend-ryo}/bin/blockfrost-backend-ryo";
environment = {
# Use config file from repository
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-ryo}/libexec/source/config/mainnet.yaml";
/*
# Use this if you want to override config/default.yaml
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-test-config}";
*/

services.blockfrost = {
enable = true;
package = blockfrost-backend-ryo;
settings = {
dbSync = {
host = builtins.getEnv "DBSYNC_HOST_MAINNET";
user = "csyncdb";
database = "csyncdb";
};
tokenRegistryUrl = builtins.getEnv "TOKEN_REGISTRY_URL_MAINNET";
};
};

};

testScript = ''
Expand All @@ -112,23 +97,24 @@ in
name = "blockfrost-backend-ryo-test-preview";

nodes.machine = {
imports = [ ./nixos-module.nix ];
# We have to increase memsize, otherwise we will get error:
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom"
virtualisation.memorySize = 4096;
# Backend service
systemd.services.blockfrost-backend-ryo = {
wantedBy = [ "multi-user.target" ];
script = "${blockfrost-backend-ryo}/bin/blockfrost-backend-ryo";
environment = {
# Use config file from repository
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-ryo}/libexec/source/config/preview.yaml";
/*
# Use this if you want to override config/default.yaml
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-test-config}";
*/

services.blockfrost = {
enable = true;
package = blockfrost-backend-ryo;
settings = {
dbSync = {
host = builtins.getEnv "DBSYNC_HOST_PREVIEW";
user = "csyncdb";
database = "csyncdb";
};
network = "preview";
tokenRegistryUrl = builtins.getEnv "TOKEN_REGISTRY_URL_TESTNETS";
};
};

};

testScript = ''
Expand All @@ -147,23 +133,24 @@ in
name = "blockfrost-backend-ryo-test-preprod";

nodes.machine = {
imports = [ ./nixos-module.nix ];
# We have to increase memsize, otherwise we will get error:
# "Kernel panic - not syncing: Out of memory: compulsory panic_on_oom"
virtualisation.memorySize = 4096;
# Backend service
systemd.services.blockfrost-backend-ryo = {
wantedBy = [ "multi-user.target" ];
script = "${blockfrost-backend-ryo}/bin/blockfrost-backend-ryo";
environment = {
# Use config file from repository
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-ryo}/libexec/source/config/preprod.yaml";
/*
# Use this if you want to override config/default.yaml
NODE_CONFIG_RUNTIME_JSON = "${blockfrost-backend-test-config}";
*/

services.blockfrost = {
enable = true;
package = blockfrost-backend-ryo;
settings = {
dbSync = {
host = builtins.getEnv "DBSYNC_HOST_PREPROD";
user = "csyncdb";
database = "csyncdb";
};
network = "preprod";
tokenRegistryUrl = builtins.getEnv "TOKEN_REGISTRY_URL_TESTNETS";
};
};

};

testScript = ''
Expand Down

0 comments on commit b692c75

Please sign in to comment.