-
Notifications
You must be signed in to change notification settings - Fork 2
/
integrationtest.go
86 lines (74 loc) · 2.11 KB
/
integrationtest.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package main
import (
"fmt"
seelog "github.com/cihub/seelog"
li "github.com/hailo-platform/H2O/hshell/integrationtest/loginintegration"
"github.com/hailo-platform/H2O/hshell/integrationtest/result"
"github.com/hailo-platform/H2O/hshell/integrationtest/testmanager"
"github.com/hailo-platform/H2O/hshell/integrationtest/variables"
"io/ioutil"
"log"
"runtime"
"strconv"
)
func init() {
seelog.ReplaceLogger(seelog.Disabled)
log.SetOutput(ioutil.Discard)
}
func main() {
runtime.GOMAXPROCS(8)
//variables.GlobalVar.SetVar("threads", "4")
//variables.GlobalVar.SetVar("rampup", "5s")
testmanager.StartTests(Integration)
res := result.GetResults()
for name, val := range res {
fmt.Printf("%+v: %+v\n", name, val)
}
}
/*func LogoutDrivers() {
for i := 0; i < 500; i++ {
tv := variables.NewVariables()
istr := strconv.Itoa(i + 21100)
postData := map[string]string{
"keywords": "ltdrive-" + istr + "@example.com",
}
rsp, _ := request.DoHttpRequest("search",
driverHost,
"/v1/driver/search/",
"GET",
postData,
validators.RegexValidator(`{"status":true,"payload":{`),
)
tv.SetVarRegex(`"id":"([^"]+)"`, "driver_id", string(rsp))
postData = map[string]string{
"driver": tv.GetVar("driver_id"),
}
_, err := request.DoHttpRequest("Logout",
driverHost,
"/v1/driver/logout/",
"POST",
postData,
validators.RegexValidator(`{"status":true,"payload":{`),
)
fmt.Println(err, postData)
}
}*/
func Integration() {
variables.GlobalVar.SetIterator("driver_id", 3, 10)
loop, err := strconv.Atoi(variables.GlobalVar.GetVar("loop"))
if err != nil {
loop = 1
}
for i := 0; i < loop; i++ {
id := variables.GlobalVar.GetVar("driver_id")
email := "moddie+driver" + id + "@hailo-platform/H2O.com"
password := "Password1"
device := "foobar"
vars := li.Login(email, password, device)
vars.UpdateVars(li.OnShift(vars.GetVar("driver_token")))
li.OffShift(vars.GetVar("driver_token"), vars.GetVar("shift_id"))
li.Logout(vars.GetVar("driver_token"))
vars = li.LoginOnShift(email, password, device)
li.OffShiftLogout(vars.GetVar("driver_token"), vars.GetVar("shift_id"))
}
}