From dbc19a33de843f28a5595ee9d6b85697a0d4fa3a Mon Sep 17 00:00:00 2001 From: kurogeek Date: Tue, 25 Nov 2025 14:30:23 +0700 Subject: [PATCH] mob next [ci-skip] [ci skip] [skip ci] lastFile:tests/tests/think-gtcm.nix --- tests/tests/think-gtcm.nix | 133 +++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 58 deletions(-) diff --git a/tests/tests/think-gtcm.nix b/tests/tests/think-gtcm.nix index 629c3c9..0ad4a6c 100644 --- a/tests/tests/think-gtcm.nix +++ b/tests/tests/think-gtcm.nix @@ -1,79 +1,96 @@ (import ../lib.nix) { name = "think-gtcm"; - nodes = { - # `self` here is set by using specialArgs in `lib.nix` - node1 = - { self, pkgs, ... }: - { - nixpkgs.overlays = [ self.overlays.packagesOverlay ]; - imports = [ self.nixosModules.think-gtcm ]; - services.think-greaterchiangmai = { - enable = true; - settings = { - APP_SERVICES_CACHE = "/run/think-gtcm/cache/services.php"; - APP_PACKAGES_CACHE = "/run/think-gtcm/cache/packages.php"; - APP_CONFIG_CACHE = "/run/think-gtcm/cache/config.php"; - APP_ROUTES_CACHE = "/run/think-gtcm/cache/routes-v7.php"; - APP_EVENTS_CACHE = "/run/think-gtcm/cache/events.php"; + nodes = + let + settings = { + APP_SERVICES_CACHE = "/run/think-gtcm/cache/services.php"; + APP_PACKAGES_CACHE = "/run/think-gtcm/cache/packages.php"; + APP_CONFIG_CACHE = "/run/think-gtcm/cache/config.php"; + APP_ROUTES_CACHE = "/run/think-gtcm/cache/routes-v7.php"; + APP_EVENTS_CACHE = "/run/think-gtcm/cache/events.php"; - DB_CONNECTION = "mysql"; - DB_HOST = "localhost"; - DB_PORT = 3306; - DB_DATABASE = "thinkgtcm"; - DB_USERNAME = "gtcm"; - DB_PASSWORD = ""; + DB_CONNECTION = "mysql"; + DB_HOST = "localhost"; + DB_PORT = 3306; + DB_DATABASE = "thinkgtcm"; + DB_USERNAME = "gtcm"; + DB_PASSWORD = ""; - APP_NAME = "Laravel"; - APP_ENV = "local"; - APP_DEBUG = "false"; - APP_URL = "http://localhost"; + APP_NAME = "Laravel"; + APP_ENV = "local"; + APP_DEBUG = "false"; + APP_URL = "http://localhost"; - LOG_CHANNEL = "stack"; - LOG_LEVEL = "debug"; + LOG_CHANNEL = "stack"; + LOG_LEVEL = "debug"; - BROADCAST_DRIVER = "log"; - CACHE_DRIVER = "file"; - FILESYSTEM_DISK = "local"; - QUEUE_CONNECTION = "sync"; - SESSION_DRIVER = "file"; - SESSION_LIFETIME = "120"; + BROADCAST_DRIVER = "log"; + CACHE_DRIVER = "file"; + FILESYSTEM_DISK = "local"; + QUEUE_CONNECTION = "sync"; + SESSION_DRIVER = "file"; + SESSION_LIFETIME = "120"; - MEMCACHED_HOST = "127.0.0.1"; + MEMCACHED_HOST = "127.0.0.1"; - REDIS_HOST = "127.0.0.1"; - REDIS_PASSWORD = "null"; - REDIS_PORT = "6379"; + REDIS_HOST = "127.0.0.1"; + REDIS_PASSWORD = "null"; + REDIS_PORT = "6379"; - MAIL_MAILER = "smtp"; - MAIL_HOST = "mailpit"; - MAIL_PORT = "1025"; - MAIL_USERNAME = "null"; - MAIL_PASSWORD = "null"; - MAIL_ENCRYPTION = "null"; - MAIL_FROM_ADDRESS = "hello@example.com"; + MAIL_MAILER = "smtp"; + MAIL_HOST = "mailpit"; + MAIL_PORT = "1025"; + MAIL_USERNAME = "null"; + MAIL_PASSWORD = "null"; + MAIL_ENCRYPTION = "null"; + MAIL_FROM_ADDRESS = "hello@example.com"; - AWS_DEFAULT_REGION = "us-east-1"; - AWS_USE_PATH_STYLE_ENDPOINT = "false"; + AWS_DEFAULT_REGION = "us-east-1"; + AWS_USE_PATH_STYLE_ENDPOINT = "false"; - PUSHER_PORT = 443; - PUSHER_SCHEME = "https"; - PUSHER_APP_CLUSTER = "mt1"; + PUSHER_PORT = 443; + PUSHER_SCHEME = "https"; + PUSHER_APP_CLUSTER = "mt1"; - UPLOAD_MAX_FILESIZE = "5000M"; - POST_MAX_SIZE = "5000M"; - - TEST_LOCAL = "false"; + UPLOAD_MAX_FILESIZE = "5000M"; + POST_MAX_SIZE = "5000M"; + TEST_LOCAL = "false"; + }; + in + { + # `self` here is set by using specialArgs in `lib.nix` + gtcm1 = + { self, pkgs, ... }: + { + nixpkgs.overlays = [ self.overlays.packagesOverlay ]; + imports = [ self.nixosModules.think-gtcm ]; + services.think-greaterchiangmai = { + enable = true; + settings = settings; }; }; - }; - }; + backend1 = + { self, pkgs, ... }: + { + nixpkgs.overlays = [ self.overlays.packagesOverlay ]; + imports = [ self.nixosModules.think-be-gtcm ]; + services.think-backend-greaterchiangmai = { + enable = true; + settings = settings; + }; + }; + }; # This is the test code that will check if our service is running correctly: testScript = '' start_all() - node1.wait_for_unit("phpfpm-think-gtcm") - node1.wait_for_open_port(80) - output = node1.succeed("curl localhost") + gtcm1.wait_for_unit("phpfpm-think-gtcm") + gtcm1.wait_for_open_port(80) + output = gtcm1.succeed("curl localhost") + + backend1.wait_for_unit("phpfpm-think-gtcm") + backend1.wait_for_open_port(80) + output = backend1.succeed("curl localhost") ''; }