func TestGetServerNginx(t *testing.T) { if !nginxPrep() { t.SkipNow() } server, err := balance.GetServer(testService1.Id, "not-real") if err == nil { t.Errorf("Failed to fail GETTING server - %v", err) t.FailNow() } balance.SetService(&testService1) server, err = balance.GetServer(testService1.Id, "not-real") if err == nil { t.Errorf("Failed to fail GETTING server - %v", err) t.FailNow() } svc := testService1 svc.Servers = append(svc.Servers, testServer2) balance.SetService(&svc) server, err = balance.GetServer(testService1.Id, testServer2.Id) if err != nil { t.Errorf("Failed to GET server - %v", err) t.FailNow() } if server.Id != testServer2.Id { t.Errorf("Read server differs from written server") } }
func TestGetServer(t *testing.T) { if skip { t.SkipNow() } server, err := balance.GetServer(testService1.Id, testServer2.Id) if err != nil { t.Errorf("Failed to GET server - %v", err) t.FailNow() } if server.Id != testServer2.Id { t.Errorf("Read server differs from written server") } }