(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestIntegrationExample(t *testing.T) { |
| 16 | if testing.Short() { |
| 17 | t.Skip() |
| 18 | return |
| 19 | } |
| 20 | |
| 21 | ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond*100) |
| 22 | defer cancel() |
| 23 | |
| 24 | err := Test(ctx, []TestFunc{ |
| 25 | func(t *T) { |
| 26 | t.Logf("Executed test no %d", 1) |
| 27 | }, |
| 28 | func(t *T) { |
| 29 | t.Log("Executed test no 2") |
| 30 | }, |
| 31 | func(t *T) { |
| 32 | t.Fatal("Fail test no 3") |
| 33 | }, |
| 34 | func(t *T) { |
| 35 | t.Fatalf("Fail test no %d", 4) |
| 36 | }, |
| 37 | func(t *T) { |
| 38 | t.Skip("Skipping test no 5") |
| 39 | }, |
| 40 | func(t *T) { |
| 41 | t.Skipf("Skipping test no %d", 5) |
| 42 | }, |
| 43 | func(t *T) { |
| 44 | t.SkipNow() |
| 45 | }, |
| 46 | func(t *T) { |
| 47 | t.Fail() |
| 48 | }, |
| 49 | func(t *T) { |
| 50 | t.FailNow() |
| 51 | }, |
| 52 | func(t *T) { |
| 53 | t.Error("Some") |
| 54 | }, |
| 55 | func(t *T) { |
| 56 | t.Errorf("formatted") |
| 57 | }, |
| 58 | }) |
| 59 | if err != context.DeadlineExceeded { |
| 60 | t.Error(err) |
| 61 | return |
| 62 | } |
| 63 | |
| 64 | req := httptest.NewRequest("GET", "/metrics", nil) |
| 65 | resp := httptest.NewRecorder() |
| 66 | metric.Handler().ServeHTTP(resp, req) |
| 67 | body := resp.Body.String() |
| 68 | |
| 69 | sn := cfg.ServiceName |
| 70 | if !strings.Contains(body, `pace_livetest_total{result="failed",service="`+sn+`"} 6`) || |
| 71 | !strings.Contains(body, `pace_livetest_total{result="skipped",service="`+sn+`"} 3`) || |
| 72 | !strings.Contains(body, `pace_livetest_total{result="succeeded",service="`+sn+`"} 2`) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…