Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #298 from tpepper/unittests
Browse files Browse the repository at this point in the history
Unittests: use testutil in ciao-scheduler's testing
  • Loading branch information
markdryan authored Jun 22, 2016
2 parents 073ce23 + 64c508c commit b5958b7
Show file tree
Hide file tree
Showing 13 changed files with 868 additions and 67 deletions.
14 changes: 7 additions & 7 deletions ciao-controller/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func TestDeleteServer(t *testing.T) {
time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -281,7 +281,7 @@ func TestServersActionStart(t *testing.T) {
time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand All @@ -297,7 +297,7 @@ func TestServersActionStart(t *testing.T) {
time.Sleep(1 * time.Second)

c = client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -343,7 +343,7 @@ func TestServersActionStop(t *testing.T) {
time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -389,7 +389,7 @@ func TestServerActionStop(t *testing.T) {
time.Sleep(2 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestServerActionStart(t *testing.T) {
time.Sleep(1 * time.Second)

c := client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand All @@ -446,7 +446,7 @@ func TestServerActionStart(t *testing.T) {
time.Sleep(1 * time.Second)

c = client.AddCmdChan(ssntp.STATS)
go client.SendStats()
go client.SendStatsCmd()
_, err = client.GetCmdChanResult(c, ssntp.STATS)
if err != nil {
t.Fatal(err)
Expand Down
16 changes: 8 additions & 8 deletions ciao-controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func TestDeleteInstance(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

c := server.AddCmdChan(ssntp.DELETE)

Expand Down Expand Up @@ -297,7 +297,7 @@ func TestStopInstance(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

c := server.AddCmdChan(ssntp.STOP)

Expand Down Expand Up @@ -325,7 +325,7 @@ func TestRestartInstance(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

c := server.AddCmdChan(ssntp.STOP)

Expand All @@ -347,7 +347,7 @@ func TestRestartInstance(t *testing.T) {
// now attempt to restart
time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

c = server.AddCmdChan(ssntp.RESTART)

Expand Down Expand Up @@ -400,7 +400,7 @@ func TestInstanceDeletedEvent(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -482,7 +482,7 @@ func TestStopFailure(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

time.Sleep(1 * time.Second)

Expand Down Expand Up @@ -534,7 +534,7 @@ func TestRestartFailure(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

time.Sleep(1 * time.Second)

Expand All @@ -555,7 +555,7 @@ func TestRestartFailure(t *testing.T) {

time.Sleep(1 * time.Second)

client.SendStats()
client.SendStatsCmd()

time.Sleep(1 * time.Second)

Expand Down
4 changes: 4 additions & 0 deletions ciao-scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,10 @@ func setSSNTPForwardRules(sched *ssntpSchedulerServer) {
Operand: ssntp.RestartFailure,
Dest: ssntp.Controller,
},
{ // all DeleteFailure events go to all Controllers
Operand: ssntp.DeleteFailure,
Dest: ssntp.Controller,
},
{ // all START command are processed by the Command forwarder
Operand: ssntp.START,
CommandForward: sched,
Expand Down
Loading

0 comments on commit b5958b7

Please sign in to comment.