Skip to content

Commit

Permalink
Merge pull request ciao-project#344 from tpepper/unittests
Browse files Browse the repository at this point in the history
Unittests: more ssntp event flows
  • Loading branch information
markdryan authored Jul 12, 2016
2 parents 451c921 + b6d25ed commit b423f16
Show file tree
Hide file tree
Showing 12 changed files with 703 additions and 266 deletions.
57 changes: 11 additions & 46 deletions ciao-controller/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,7 @@ func TestDeleteServer(t *testing.T) {

time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(2 * time.Second)

Expand Down Expand Up @@ -280,12 +275,7 @@ func TestServersActionStart(t *testing.T) {

time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

Expand All @@ -296,12 +286,7 @@ func TestServersActionStart(t *testing.T) {

time.Sleep(1 * time.Second)

c = client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -342,12 +327,7 @@ func TestServersActionStop(t *testing.T) {

time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -388,12 +368,7 @@ func TestServerActionStop(t *testing.T) {

time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -422,35 +397,25 @@ func TestServerActionStart(t *testing.T) {

time.Sleep(1 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

c = server.AddCmdChan(ssntp.STOP)
serverCh := server.AddCmdChan(ssntp.STOP)

err = context.stopInstance(servers.Servers[0].ID)
if err != nil {
t.Fatal(err)
}

_, err = server.GetCmdChanResult(c, ssntp.STOP)
_, err = server.GetCmdChanResult(serverCh, ssntp.STOP)
if err != nil {
t.Fatal(err)
}

time.Sleep(1 * time.Second)

c = client.AddCmdChan(ssntp.STATS)
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
}
sendStatsCmd(client, t)

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -924,7 +889,7 @@ func TestListTraces(t *testing.T) {
client := testStartTracedWorkload(t)
defer client.Ssntp.Close()

client.SendTrace()
sendTraceReportEvent(client, t)

time.Sleep(2 * time.Second)

Expand Down Expand Up @@ -1010,7 +975,7 @@ func TestTraceData(t *testing.T) {
client := testStartTracedWorkload(t)
defer client.Ssntp.Close()

client.SendTrace()
sendTraceReportEvent(client, t)

time.Sleep(2 * time.Second)

Expand Down
Loading

0 comments on commit b423f16

Please sign in to comment.