| 
									
										
										
										
											2014-05-27 22:54:43 +02:00
										 |  |  | # This test runs influxdb and checks if influxdb is up and running | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-12 12:09:40 +02:00
										 |  |  | import ./make-test.nix ({ pkgs, ...} : { | 
					
						
							| 
									
										
										
										
											2014-06-28 16:04:49 +02:00
										 |  |  |   name = "influxdb"; | 
					
						
							| 
									
										
										
										
											2015-07-12 12:09:40 +02:00
										 |  |  |   meta = with pkgs.stdenv.lib.maintainers; { | 
					
						
							|  |  |  |     maintainers = [ chaoflow offline ]; | 
					
						
							|  |  |  |   }; | 
					
						
							| 
									
										
										
										
											2014-06-28 16:04:49 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-27 22:54:43 +02:00
										 |  |  |   nodes = { | 
					
						
							|  |  |  |     one = { config, pkgs, ... }: { | 
					
						
							|  |  |  |       services.influxdb.enable = true; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   testScript = ''
 | 
					
						
							|  |  |  |     startAll; | 
					
						
							|  |  |  |    | 
					
						
							|  |  |  |     $one->waitForUnit("influxdb.service"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Check if admin interface is avalible | 
					
						
							|  |  |  |     $one->waitUntilSucceeds("curl -f 127.0.0.1:8083"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # create database | 
					
						
							|  |  |  |     $one->succeed(q~ | 
					
						
							|  |  |  |       curl -X POST 'http://localhost:8086/db?u=root&p=root' \ | 
					
						
							|  |  |  |         -d '{"name": "test"}' | 
					
						
							|  |  |  |     ~); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # write some points and run simple query | 
					
						
							|  |  |  |     $one->succeed(q~ | 
					
						
							|  |  |  |       curl -X POST 'http://localhost:8086/db/test/series?u=root&p=root' \ | 
					
						
							|  |  |  |         -d '[{"name":"foo","columns":["val"],"points":[[6666]]}]' | 
					
						
							|  |  |  |     ~); | 
					
						
							|  |  |  |     $one->succeed(q~ | 
					
						
							|  |  |  |       curl -G 'http://localhost:8086/db/test/series?u=root&p=root' \ | 
					
						
							|  |  |  |         --data-urlencode 'q=select * from foo limit 1' | grep 6666 | 
					
						
							|  |  |  |     ~); | 
					
						
							|  |  |  |   '';
 | 
					
						
							| 
									
										
										
										
											2015-07-12 12:09:40 +02:00
										 |  |  | }) |