forked from Fediversity/simple-nixos-fediverse
test image gets uploaded to garage
This commit is contained in:
parent
4178822ee2
commit
8a09ba967a
|
@ -125,9 +125,9 @@ pkgs.nixosTest {
|
||||||
imagemagick
|
imagemagick
|
||||||
];
|
];
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
# AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.pixelfed.id;
|
|
||||||
# AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.pixelfed.secret;
|
|
||||||
POST_MEDIA = ./fediversity.png;
|
POST_MEDIA = ./fediversity.png;
|
||||||
|
AWS_ACCESS_KEY_ID = config.services.garage.ensureKeys.pixelfed.id;
|
||||||
|
AWS_SECRET_ACCESS_KEY = config.services.garage.ensureKeys.pixelfed.secret;
|
||||||
};
|
};
|
||||||
# chrome does not like being run as root
|
# chrome does not like being run as root
|
||||||
users.users.selenium = {
|
users.users.selenium = {
|
||||||
|
@ -161,5 +161,20 @@ pkgs.nixosTest {
|
||||||
image_check = re.match(".*#FF0500.*", displayed_colors, re.S)
|
image_check = re.match(".*#FF0500.*", displayed_colors, re.S)
|
||||||
if image_check is None:
|
if image_check is None:
|
||||||
raise Exception("cannot detect the uploaded image on pixelfed page.")
|
raise Exception("cannot detect the uploaded image on pixelfed page.")
|
||||||
|
|
||||||
|
with subtest("access garage"):
|
||||||
|
server.succeed("mc alias set garage http://s3.garage.localhost:3900 --api s3v4 --path off $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY")
|
||||||
|
server.succeed("mc ls garage/pixelfed")
|
||||||
|
|
||||||
|
with subtest("access image in garage"):
|
||||||
|
image = server.succeed("mc find garage --regex '\.png' --ignore '*_thumb.png'")
|
||||||
|
image = image.rstrip()
|
||||||
|
if image == "":
|
||||||
|
raise Exception("image posted to mastodon did not get stored in garage")
|
||||||
|
server.succeed(f"mc cat {image} >/garage-image.png")
|
||||||
|
garage_image_hash = server.succeed("identify -quiet -format '%#' /garage-image.png")
|
||||||
|
image_hash = server.succeed("identify -quiet -format '%#' $POST_MEDIA")
|
||||||
|
if garage_image_hash != image_hash:
|
||||||
|
raise Exception("image stored in garage did not match image uploaded")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue