Skip to content

Commit 9f1dd0d

Browse files
Update test after api.github.com ratelimit avoidance
1 parent d9abce4 commit 9f1dd0d

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

tests/github-flakes.nix

+22-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ with import (nixpkgs + "/nixos/lib/testing-python.nix") {
77

88
let
99

10-
# Generate a fake root CA and a fake api.github.com / channels.nixos.org certificate.
10+
# Generate a fake root CA and a fake api.github.com / github.com / channels.nixos.org certificate.
1111
cert = pkgs.runCommand "cert" { buildInputs = [ pkgs.openssl ]; }
1212
''
1313
mkdir -p $out
@@ -18,7 +18,7 @@ let
1818
1919
openssl req -newkey rsa:2048 -nodes -keyout $out/server.key \
2020
-subj "/C=CN/ST=Denial/L=Springfield/O=Dis/CN=github.com" -out server.csr
21-
openssl x509 -req -extfile <(printf "subjectAltName=DNS:api.github.com,DNS:channels.nixos.org") \
21+
openssl x509 -req -extfile <(printf "subjectAltName=DNS:api.github.com,DNS:github.com,DNS:channels.nixos.org") \
2222
-days 36500 -in server.csr -CA $out/ca.crt -CAkey ca.key -CAcreateserial -out $out/server.crt
2323
'';
2424

@@ -47,18 +47,20 @@ let
4747

4848
api = pkgs.runCommand "nixpkgs-flake" {}
4949
''
50-
mkdir -p $out/tarball
50+
mkdir -p $out/commits
51+
echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/HEAD
52+
'';
53+
54+
archive = pkgs.runCommand "nixpkgs-flake" {}
55+
''
56+
mkdir -p $out/archive
5157
5258
dir=NixOS-nixpkgs-${nixpkgs.shortRev}
5359
cp -prd ${nixpkgs} $dir
5460
# Set the correct timestamp in the tarball.
5561
find $dir -print0 | xargs -0 touch -t ${builtins.substring 0 12 nixpkgs.lastModifiedDate}.${builtins.substring 12 2 nixpkgs.lastModifiedDate} --
56-
tar cfz $out/tarball/${nixpkgs.rev} $dir --hard-dereference
57-
58-
mkdir -p $out/commits
59-
echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/HEAD
62+
tar cfz $out/archive/${nixpkgs.rev}.tar.gz $dir --hard-dereference
6063
'';
61-
6264
in
6365

6466
makeTest (
@@ -97,6 +99,16 @@ makeTest (
9799
}
98100
];
99101
};
102+
services.httpd.virtualHosts."github.com" =
103+
{ forceSSL = true;
104+
sslServerKey = "${cert}/server.key";
105+
sslServerCert = "${cert}/server.crt";
106+
servedDirs =
107+
[ { urlPath = "/NixOS/nixpkgs";
108+
dir = archive;
109+
}
110+
];
111+
};
100112
};
101113

102114
client =
@@ -109,7 +121,7 @@ makeTest (
109121
nix.extraOptions = "experimental-features = nix-command flakes";
110122
environment.systemPackages = [ pkgs.jq ];
111123
networking.hosts.${(builtins.head nodes.github.config.networking.interfaces.eth1.ipv4.addresses).address} =
112-
[ "channels.nixos.org" "api.github.com" ];
124+
[ "channels.nixos.org" "api.github.com" "github.com" ];
113125
security.pki.certificateFiles = [ "${cert}/ca.crt" ];
114126
};
115127
};
@@ -123,7 +135,7 @@ makeTest (
123135
124136
github.wait_for_unit("httpd.service")
125137
126-
client.succeed("curl -v https://api.github.com/ >&2")
138+
client.succeed("curl -v https://github.com/ >&2")
127139
client.succeed("nix registry list | grep nixpkgs")
128140
129141
rev = client.succeed("nix flake info nixpkgs --json | jq -r .revision")

0 commit comments

Comments
 (0)