| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | // Copyright 2015 The Prometheus Authors
 | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | // Licensed under the Apache License, Version 2.0 (the "License");
 | 
					
						
							|  |  |  | // you may not use this file except in compliance with the License.
 | 
					
						
							|  |  |  | // You may obtain a copy of the License at
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Unless required by applicable law or agreed to in writing, software
 | 
					
						
							|  |  |  | // distributed under the License is distributed on an "AS IS" BASIS,
 | 
					
						
							|  |  |  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
					
						
							|  |  |  | // See the License for the specific language governing permissions and
 | 
					
						
							|  |  |  | // limitations under the License.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package promql | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 	"path/filepath" | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 	"testing" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | func TestEvaluations(t *testing.T) { | 
					
						
							|  |  |  | 	files, err := filepath.Glob("testdata/*.test") | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 		t.Fatal(err) | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 	for _, fn := range files { | 
					
						
							| 
									
										
										
										
											2015-08-24 21:07:27 +08:00
										 |  |  | 		test, err := newTestFromFile(t, fn) | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 		if err != nil { | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 			t.Errorf("error creating test for %s: %s", fn, err) | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 		err = test.Run() | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			t.Errorf("error running test %s: %s", fn, err) | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2015-05-12 19:41:57 +08:00
										 |  |  | 		test.Close() | 
					
						
							| 
									
										
										
										
											2015-03-31 01:13:36 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } |