forked from fediversity/fediversity
		
	test image gets uploaded to garage
This commit is contained in:
		
							parent
							
								
									5b26cfc7a9
								
							
						
					
					
						commit
						3652a443b1
					
				
					 1 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -125,9 +125,9 @@ pkgs.nixosTest {
 | 
			
		|||
        imagemagick
 | 
			
		||||
      ];
 | 
			
		||||
      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;
 | 
			
		||||
        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
 | 
			
		||||
      users.users.selenium = {
 | 
			
		||||
| 
						 | 
				
			
			@ -161,5 +161,20 @@ pkgs.nixosTest {
 | 
			
		|||
      image_check = re.match(".*#FF0500.*", displayed_colors, re.S)
 | 
			
		||||
      if image_check is None:
 | 
			
		||||
        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")
 | 
			
		||||
  '';
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue