forked from Fediversity/Fediversity
destructure pkgs argument in package modules
This commit is contained in:
parent
d67f533948
commit
27398befd8
4 changed files with 67 additions and 32 deletions
|
@ -6,8 +6,8 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
tests = {
|
tests = {
|
||||||
mastodon = import ./tests/mastodon.nix { inherit pkgs; };
|
mastodon = pkgs.callPackage ./tests/mastodon.nix { };
|
||||||
pixelfed-garage = import ./tests/pixelfed-garage.nix { inherit pkgs; };
|
pixelfed-garage = pkgs.callPackage ./tests/pixelfed-garage.nix { };
|
||||||
peertube = import ./tests/peertube.nix { inherit pkgs; };
|
peertube = pkgs.callPackage ./tests/peertube.nix { };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,20 +3,32 @@
|
||||||
## NOTE: This test will fail for Mastodon < 4.3 because of
|
## NOTE: This test will fail for Mastodon < 4.3 because of
|
||||||
## https://github.com/mastodon/mastodon/issues/31145
|
## https://github.com/mastodon/mastodon/issues/31145
|
||||||
|
|
||||||
{ pkgs, ... }:
|
{
|
||||||
|
copyPathToStore,
|
||||||
|
expect,
|
||||||
|
firefox-unwrapped,
|
||||||
|
geckodriver,
|
||||||
|
helix,
|
||||||
|
imagemagick,
|
||||||
|
lib,
|
||||||
|
nixosTest,
|
||||||
|
python3,
|
||||||
|
python3Packages,
|
||||||
|
toot,
|
||||||
|
writers,
|
||||||
|
xh,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
|
||||||
|
|
||||||
## FIXME: this binding was not used, but maybe we want a side-effect or something?
|
## FIXME: this binding was not used, but maybe we want a side-effect or something?
|
||||||
# rebuildableTest = import ./rebuildableTest.nix pkgs;
|
# rebuildableTest = import ./rebuildableTest.nix pkgs;
|
||||||
|
|
||||||
testImage = pkgs.copyPathToStore ./green.png;
|
testImage = copyPathToStore ./green.png;
|
||||||
testImageColour = "#00FF00";
|
testImageColour = "#00FF00";
|
||||||
|
|
||||||
seleniumScript =
|
seleniumScript =
|
||||||
pkgs.writers.writePython3Bin "selenium-script"
|
writers.writePython3Bin "selenium-script" { libraries = with python3Packages; [ selenium ]; }
|
||||||
{ libraries = with pkgs.python3Packages; [ selenium ]; }
|
|
||||||
''
|
''
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
|
@ -27,7 +39,7 @@ let
|
||||||
options.add_argument("--headless")
|
options.add_argument("--headless")
|
||||||
# devtools don't show up in headless screenshots
|
# devtools don't show up in headless screenshots
|
||||||
# options.add_argument("-devtools")
|
# options.add_argument("-devtools")
|
||||||
service = webdriver.FirefoxService(executable_path="${lib.getExe pkgs.geckodriver}") # noqa: E501
|
service = webdriver.FirefoxService(executable_path="${lib.getExe geckodriver}") # noqa: E501
|
||||||
|
|
||||||
driver = webdriver.Firefox(options=options, service=service)
|
driver = webdriver.Firefox(options=options, service=service)
|
||||||
driver.get("http://mastodon.localhost/public/local")
|
driver.get("http://mastodon.localhost/public/local")
|
||||||
|
@ -42,7 +54,7 @@ let
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
pkgs.nixosTest {
|
nixosTest {
|
||||||
name = "mastodon";
|
name = "mastodon";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -57,7 +69,7 @@ pkgs.nixosTest {
|
||||||
../vm/interactive-vm.nix
|
../vm/interactive-vm.nix
|
||||||
];
|
];
|
||||||
# TODO: pair down
|
# TODO: pair down
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = [
|
||||||
python3
|
python3
|
||||||
firefox-unwrapped
|
firefox-unwrapped
|
||||||
geckodriver
|
geckodriver
|
||||||
|
|
|
@ -1,17 +1,30 @@
|
||||||
## This file is a basic test of Peertube functionalities.
|
## This file is a basic test of Peertube functionalities.
|
||||||
|
|
||||||
{ pkgs, ... }:
|
{
|
||||||
|
copyPathToStore,
|
||||||
|
expect,
|
||||||
|
ffmpeg,
|
||||||
|
firefox-unwrapped,
|
||||||
|
geckodriver,
|
||||||
|
imagemagick,
|
||||||
|
lib,
|
||||||
|
nixosTest,
|
||||||
|
python3,
|
||||||
|
python3Packages,
|
||||||
|
toot,
|
||||||
|
writeShellScriptBin,
|
||||||
|
writers,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
testVideo = copyPathToStore ./green.mp4;
|
||||||
|
|
||||||
testVideo = pkgs.copyPathToStore ./green.mp4;
|
|
||||||
testVideoColour = "#00FF00";
|
testVideoColour = "#00FF00";
|
||||||
|
|
||||||
postVideoInBrowser =
|
postVideoInBrowser =
|
||||||
pkgs.writers.writePython3Bin "post-video-in-browser"
|
writers.writePython3Bin "post-video-in-browser"
|
||||||
{
|
{
|
||||||
libraries = with pkgs.python3Packages; [ selenium ];
|
libraries = with python3Packages; [ selenium ];
|
||||||
flakeIgnore = [ "E501" ]; # welcome to the 21st century
|
flakeIgnore = [ "E501" ]; # welcome to the 21st century
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
|
@ -30,7 +43,7 @@ let
|
||||||
options.add_argument("--headless")
|
options.add_argument("--headless")
|
||||||
print("########################################", file=sys.stderr)
|
print("########################################", file=sys.stderr)
|
||||||
print("B", file=sys.stderr)
|
print("B", file=sys.stderr)
|
||||||
service = webdriver.FirefoxService(executable_path="${lib.getExe pkgs.geckodriver}")
|
service = webdriver.FirefoxService(executable_path="${lib.getExe geckodriver}")
|
||||||
print("########################################", file=sys.stderr)
|
print("########################################", file=sys.stderr)
|
||||||
print("C", file=sys.stderr)
|
print("C", file=sys.stderr)
|
||||||
driver = webdriver.Firefox(options=options, service=service)
|
driver = webdriver.Firefox(options=options, service=service)
|
||||||
|
@ -143,7 +156,7 @@ let
|
||||||
driver.close()
|
driver.close()
|
||||||
'';
|
'';
|
||||||
|
|
||||||
acquireRootPassword = pkgs.writeShellScriptBin "acquire-root-password" ''
|
acquireRootPassword = writeShellScriptBin "acquire-root-password" ''
|
||||||
readonly retry=30
|
readonly retry=30
|
||||||
readonly wait=60
|
readonly wait=60
|
||||||
|
|
||||||
|
@ -161,7 +174,7 @@ let
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
pkgs.nixosTest {
|
nixosTest {
|
||||||
name = "peertube";
|
name = "peertube";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -180,7 +193,7 @@ pkgs.nixosTest {
|
||||||
cores = 8;
|
cores = 8;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = [
|
||||||
python3
|
python3
|
||||||
firefox-unwrapped
|
firefox-unwrapped
|
||||||
geckodriver
|
geckodriver
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
{ pkgs, ... }:
|
{
|
||||||
|
chromedriver,
|
||||||
|
chromium,
|
||||||
|
helix,
|
||||||
|
imagemagick,
|
||||||
|
lib,
|
||||||
|
nixosTest,
|
||||||
|
python3,
|
||||||
|
python3Packages,
|
||||||
|
writers,
|
||||||
|
xh,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
|
||||||
|
|
||||||
## FIXME: this binding was not used but maybe we want a side effect or something?
|
## FIXME: this binding was not used but maybe we want a side effect or something?
|
||||||
# rebuildableTest = import ./rebuildableTest.nix pkgs;
|
# rebuildableTest = import ./rebuildableTest.nix pkgs;
|
||||||
|
|
||||||
|
@ -22,7 +32,7 @@ let
|
||||||
print("Create and configure driver...", file=sys.stderr)
|
print("Create and configure driver...", file=sys.stderr)
|
||||||
options = Options()
|
options = Options()
|
||||||
# options.add_argument("--headless=new")
|
# options.add_argument("--headless=new")
|
||||||
service = webdriver.ChromeService(executable_path="${lib.getExe pkgs.chromedriver}") # noqa: E501
|
service = webdriver.ChromeService(executable_path="${lib.getExe chromedriver}") # noqa: E501
|
||||||
driver = webdriver.Chrome(options=options, service=service)
|
driver = webdriver.Chrome(options=options, service=service)
|
||||||
driver.implicitly_wait(30)
|
driver.implicitly_wait(30)
|
||||||
driver.set_window_size(1280, 960)
|
driver.set_window_size(1280, 960)
|
||||||
|
@ -54,8 +64,8 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
seleniumScriptPostPicture =
|
seleniumScriptPostPicture =
|
||||||
pkgs.writers.writePython3Bin "selenium-script-post-picture"
|
writers.writePython3Bin "selenium-script-post-picture"
|
||||||
{ libraries = with pkgs.python3Packages; [ selenium ]; }
|
{ libraries = with python3Packages; [ selenium ]; }
|
||||||
''
|
''
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
@ -97,8 +107,8 @@ let
|
||||||
${seleniumQuit}'';
|
${seleniumQuit}'';
|
||||||
|
|
||||||
seleniumScriptGetSrc =
|
seleniumScriptGetSrc =
|
||||||
pkgs.writers.writePython3Bin "selenium-script-get-src"
|
writers.writePython3Bin "selenium-script-get-src"
|
||||||
{ libraries = with pkgs.python3Packages; [ selenium ]; }
|
{ libraries = with python3Packages; [ selenium ]; }
|
||||||
''
|
''
|
||||||
${seleniumImports}
|
${seleniumImports}
|
||||||
${seleniumSetup}
|
${seleniumSetup}
|
||||||
|
@ -114,7 +124,7 @@ let
|
||||||
${seleniumQuit}'';
|
${seleniumQuit}'';
|
||||||
|
|
||||||
in
|
in
|
||||||
pkgs.nixosTest {
|
nixosTest {
|
||||||
name = "test-pixelfed-garage";
|
name = "test-pixelfed-garage";
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
|
@ -149,7 +159,7 @@ pkgs.nixosTest {
|
||||||
../vm/pixelfed-vm.nix
|
../vm/pixelfed-vm.nix
|
||||||
];
|
];
|
||||||
# TODO: pair down
|
# TODO: pair down
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = [
|
||||||
python3
|
python3
|
||||||
chromium
|
chromium
|
||||||
chromedriver
|
chromedriver
|
||||||
|
|
Loading…
Add table
Reference in a new issue