| 
									
										
										
										
											2019-11-25 00:36:37 -08:00
										 |  |  | import ./make-test-python.nix ({ lib, pkgs, ... }: { | 
					
						
							| 
									
										
										
										
											2018-11-17 15:02:00 +01:00
										 |  |  |   name = "syncthing-relay"; | 
					
						
							| 
									
										
										
										
											2021-01-10 20:08:30 +01:00
										 |  |  |   meta.maintainers = with pkgs.lib.maintainers; [ delroth ]; | 
					
						
							| 
									
										
										
										
											2018-11-17 15:02:00 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   machine = { | 
					
						
							|  |  |  |     environment.systemPackages = [ pkgs.jq ]; | 
					
						
							|  |  |  |     services.syncthing.relay = { | 
					
						
							|  |  |  |       enable = true; | 
					
						
							|  |  |  |       providedBy = "nixos-test"; | 
					
						
							|  |  |  |       pools = [];  # Don't connect to any pool while testing. | 
					
						
							|  |  |  |       port = 12345; | 
					
						
							|  |  |  |       statusPort = 12346; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   testScript = ''
 | 
					
						
							| 
									
										
										
										
											2019-11-25 00:36:37 -08:00
										 |  |  |     machine.wait_for_unit("syncthing-relay.service") | 
					
						
							|  |  |  |     machine.wait_for_open_port(12345) | 
					
						
							|  |  |  |     machine.wait_for_open_port(12346) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     out = machine.succeed( | 
					
						
							| 
									
										
										
										
											2020-09-15 15:27:51 -07:00
										 |  |  |         "curl -sSf http://localhost:12346/status | jq -r '.options.\"provided-by\"'" | 
					
						
							| 
									
										
										
										
											2019-11-25 00:36:37 -08:00
										 |  |  |     ) | 
					
						
							|  |  |  |     assert "nixos-test" in out | 
					
						
							| 
									
										
										
										
											2018-11-17 15:02:00 +01:00
										 |  |  |   '';
 | 
					
						
							|  |  |  | }) |