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