| index cd705cb48..aee1c1261 100644 |
| --- a/apps_policy_test.go |
| +++ b/apps_policy_test.go |
| @@ -217,7 +217,7 @@ func TestInstancesSetSizeUsesThePolicyDoor(t *testing.T) { |
| if c.puts[0] != `{"size":{"host":"shop-a.example.com","value":"xlarge"}}` || c.ifMatch[0] != "e1" { |
| t.Fatalf("PUT %s If-Match %q", c.puts[0], c.ifMatch[0]) |
| } |
| - if want := fmt.Sprintf(instancesSetSizeDone+"\n", "shop-a.example.com", "xlarge"); out.String() != want { |
| + if want := fmt.Sprintf(instancesSetSizeDone+"\n", "shop-a.example.com", "xlarge") + sizeTakesEffectLine + "\n"; out.String() != want { |
| t.Fatalf("stdout = %q, want %q", out.String(), want) |
| } |
| |
| @@ -230,7 +230,7 @@ func TestInstancesSetSizeUsesThePolicyDoor(t *testing.T) { |
| if c.puts[0] != `{"size":{"host":"shop-a.example.com","value":"default"}}` { |
| t.Fatalf("PUT %s", c.puts[0]) |
| } |
| - if want := fmt.Sprintf(instancesSetSizeDefault+"\n", "shop-a.example.com"); out.String() != want { |
| + if want := fmt.Sprintf(instancesSetSizeDefault+"\n", "shop-a.example.com") + sizeTakesEffectLine + "\n"; out.String() != want { |
| t.Fatalf("stdout = %q, want %q", out.String(), want) |
| } |
| |
| @@ -369,7 +369,7 @@ func TestAppsSetRunPolicyChangePrintsWhatTheConsoleStored(t *testing.T) { |
| if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil { |
| t.Fatal(err) |
| } |
| - want := fmt.Sprintf(appsSetEgressDone+"\n", "shop", "10.0.5.20, fd00:5::20") + fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") |
| + want := fmt.Sprintf(appsSetEgressDone+"\n", "shop", "10.0.5.20, fd00:5::20") + fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") + sizeTakesEffectLine + "\n" |
| if out.String() != want { |
| t.Fatalf("stdout = %q, want %q", out.String(), want) |
| } |
| @@ -384,7 +384,7 @@ func TestAppsSetRunPolicyChangePrintsWhatTheConsoleStored(t *testing.T) { |
| if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil { |
| t.Fatal(err) |
| } |
| - want = fmt.Sprintf(appsSetEgressCleared+"\n", "shop") + fmt.Sprintf(appsSetSizeCleared+"\n", "shop") |
| + want = fmt.Sprintf(appsSetEgressCleared+"\n", "shop") + fmt.Sprintf(appsSetSizeCleared+"\n", "shop") + sizeTakesEffectLine + "\n" |
| if out.String() != want { |
| t.Fatalf("stdout = %q, want %q", out.String(), want) |
| } |
| @@ -463,9 +463,12 @@ func TestPrintSizeCommitted(t *testing.T) { |
| } |
| |
| // After a size change, both verbs print the reply's committed lines under |
| -// the size line; an older console's reply, with no committed key, prints |
| -// none. |
| +// the size line, then when the new size takes effect (ruling 12); an older |
| +// console's reply, with no committed key, prints no committed line. |
| func TestSizeChangePrintsCommitted(t *testing.T) { |
| + if sizeTakesEffectLine != "The new memory size applies when an instance next starts or is deployed. CPU and IO apply now." { |
| + t.Fatalf("sizeTakesEffectLine = %q", sizeTakesEffectLine) |
| + } |
| out := captureStdout(t) |
| committed := `"committed":[{"box":"annie","committed_mib":2304,"total_mib":3884,"free_mib":1200}]` |
| line := "annie: 2304 MiB committed to awake instances, of 3884 MiB. 1200 MiB free.\n" |
| @@ -479,7 +482,7 @@ func TestSizeChangePrintsCommitted(t *testing.T) { |
| if err := appsSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", nil, nil, change); err != nil { |
| t.Fatal(err) |
| } |
| - if want := fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") + line; out.String() != want { |
| + if want := fmt.Sprintf(appsSetSizeDone+"\n", "shop", "large") + line + sizeTakesEffectLine + "\n"; out.String() != want { |
| t.Fatalf("apps set: stdout = %q, want %q", out.String(), want) |
| } |
| |
| @@ -490,7 +493,7 @@ func TestSizeChangePrintsCommitted(t *testing.T) { |
| if err := instancesSetRun(context.Background(), c.session(t), apiAcct{Seg: "bab"}, "shop", "shop-a.example.com", nil, nil, &large); err != nil { |
| t.Fatal(err) |
| } |
| - if want := fmt.Sprintf(instancesSetSizeDone+"\n", "shop-a.example.com", "large") + line; out.String() != want { |
| + if want := fmt.Sprintf(instancesSetSizeDone+"\n", "shop-a.example.com", "large") + line + sizeTakesEffectLine + "\n"; out.String() != want { |
| t.Fatalf("instances set: stdout = %q, want %q", out.String(), want) |
| } |
| } |