forked from micro/micro
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevents_test.go
executable file
·51 lines (44 loc) · 1.17 KB
/
events_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//go:build integration
// +build integration
package test
import (
"errors"
"strings"
"testing"
"time"
)
func TestEventsStream(t *testing.T) {
// temporarily nuking this test
return
TrySuite(t, testEventsStream, retryCount)
}
func testEventsStream(t *T) {
t.Parallel()
serv := NewServer(t, WithLogin(), WithNamespace("micro"))
defer serv.Close()
if err := serv.Run(); err != nil {
return
}
cmd := serv.Command()
// Temp fix to support k8s tests until we have file upload to remote server
if outp, err := cmd.Exec("run", "--image", "localhost:5000/cells:v3", "/service/events"); err != nil {
t.Fatalf("Error running service: %v, %v", err, string(outp))
return
}
if err := Try("Check logs for success", t, func() ([]byte, error) {
outp, _ := cmd.Exec("status")
outp, err := cmd.Exec("logs", "-n", "200", "events")
if err != nil {
return outp, err
}
if !strings.Contains(string(outp), "TEST1: Finished ok") {
return outp, errors.New("Received event log not found")
}
if !strings.Contains(string(outp), "TEST2: Finished ok") {
return outp, errors.New("Test 2 not finished")
}
return outp, nil
}, 180*time.Second); err != nil {
return
}
}