mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
fix tests + english
This commit is contained in:
parent
c10a300b58
commit
141e72246d
@ -229,8 +229,8 @@ Changes to Outputs:
|
||||
~ sensitive_after = (sensitive value)
|
||||
~ sensitive_before = (sensitive value)
|
||||
|
||||
You can apply this plan to save these new output values to the OpenTF
|
||||
state, without changing any real infrastructure.
|
||||
You can apply this plan to save these new output values to the OpenTF state,
|
||||
without changing any real infrastructure.
|
||||
`)
|
||||
|
||||
if output := done(t).Stdout(); !strings.Contains(output, expectedOutput) {
|
||||
@ -322,13 +322,13 @@ func TestLocal_planTainted(t *testing.T) {
|
||||
t.Fatal("plan should not be empty")
|
||||
}
|
||||
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
-/+ destroy and then create replacement
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
|
||||
# test_instance.foo is tainted, so must be replaced
|
||||
# test_instance.foo is tainted, so it must be replaced
|
||||
-/+ resource "test_instance" "foo" {
|
||||
# (1 unchanged attribute hidden)
|
||||
|
||||
@ -420,8 +420,8 @@ func TestLocal_planDeposedOnly(t *testing.T) {
|
||||
// it's also possible for there to be _multiple_ deposed objects, in the
|
||||
// unlikely event that create_before_destroy _keeps_ crashing across
|
||||
// subsequent runs.
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
+ create
|
||||
- destroy
|
||||
|
||||
@ -450,7 +450,7 @@ OpenTF will perform the following actions:
|
||||
|
||||
Plan: 1 to add, 0 to change, 1 to destroy.`
|
||||
if output := done(t).Stdout(); !strings.Contains(output, expectedOutput) {
|
||||
t.Fatalf("Unexpected output:\n%s", output)
|
||||
t.Fatalf("Unexpected output\ngot\n%s\n\nwant:\n%s", output, expectedOutput)
|
||||
}
|
||||
}
|
||||
|
||||
@ -492,13 +492,13 @@ func TestLocal_planTainted_createBeforeDestroy(t *testing.T) {
|
||||
t.Fatal("plan should not be empty")
|
||||
}
|
||||
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution
|
||||
plan. Resource actions are indicated with the following symbols:
|
||||
expectedOutput := `OpenTF used the selected providers to generate the following execution plan.
|
||||
Resource actions are indicated with the following symbols:
|
||||
+/- create replacement and then destroy
|
||||
|
||||
OpenTF will perform the following actions:
|
||||
|
||||
# test_instance.foo is tainted, so must be replaced
|
||||
# test_instance.foo is tainted, so it must be replaced
|
||||
+/- resource "test_instance" "foo" {
|
||||
# (1 unchanged attribute hidden)
|
||||
|
||||
@ -507,7 +507,7 @@ OpenTF will perform the following actions:
|
||||
|
||||
Plan: 1 to add, 0 to change, 1 to destroy.`
|
||||
if output := done(t).Stdout(); !strings.Contains(output, expectedOutput) {
|
||||
t.Fatalf("Unexpected output:\n%s", output)
|
||||
t.Fatalf("Unexpected output\ngot\n%s\n\nwant:\n%s", output, expectedOutput)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
renderer.Streams.Println()
|
||||
}
|
||||
renderer.Streams.Print(
|
||||
renderer.Colorize.Color("\n[reset][bold][red]Planning failed.[reset][bold] Terraform encountered an error while generating this plan.[reset]\n\n"),
|
||||
renderer.Colorize.Color("\n[reset][bold][red]Planning failed.[reset][bold] OpenTF encountered an error while generating this plan.[reset]\n\n"),
|
||||
)
|
||||
} else {
|
||||
switch mode {
|
||||
@ -117,7 +117,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[reset][bold][green]No changes.[reset][bold] Your infrastructure still matches the configuration.[reset]\n\n"))
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Terraform has checked that the real remote objects still match the result of your most recent changes, and found no differences.",
|
||||
"OpenTF has checked that the real remote objects still match the result of your most recent changes, and found no differences.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
case plans.DestroyMode:
|
||||
if haveRefreshChanges {
|
||||
@ -126,7 +126,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
}
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[reset][bold][green]No changes.[reset][bold] No objects need to be destroyed.[reset]\n\n"))
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Either you have not created any objects yet or the existing objects were already deleted outside of Terraform.",
|
||||
"Either you have not created any objects yet or the existing objects were already deleted outside of OpenTF.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
default:
|
||||
if haveRefreshChanges {
|
||||
@ -155,10 +155,10 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
suggestion := "."
|
||||
if !renderer.RunningInAutomation {
|
||||
// The normal message includes a specific command line to run.
|
||||
suggestion = ":\n terraform apply -refresh-only"
|
||||
suggestion = ":\n opentf apply -refresh-only"
|
||||
}
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan"+suggestion,
|
||||
"Your configuration already matches the changes detected above. If you'd like to update the OpenTF state to match, create and apply a refresh-only plan"+suggestion,
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
}
|
||||
@ -168,7 +168,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
// If we get down here then we're just in the simple situation where
|
||||
// the plan isn't applyable at all.
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.",
|
||||
"OpenTF has compared your real infrastructure against your configuration and found no differences, so no changes are needed.",
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
}
|
||||
@ -182,7 +182,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
if willPrintResourceChanges {
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\nTerraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:",
|
||||
"\nOpenTF used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
if counts[plans.Create] > 0 {
|
||||
renderer.Streams.Println(renderer.Colorize.Color(actionDescription(plans.Create)))
|
||||
@ -206,9 +206,9 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
|
||||
if len(changes) > 0 {
|
||||
if checkOpts(plans.Errored) {
|
||||
renderer.Streams.Printf("\nTerraform planned the following actions, but then encountered a problem:\n")
|
||||
renderer.Streams.Printf("\nOpenTF planned the following actions, but then encountered a problem:\n")
|
||||
} else {
|
||||
renderer.Streams.Printf("\nTerraform will perform the following actions:\n")
|
||||
renderer.Streams.Printf("\nOpenTF will perform the following actions:\n")
|
||||
}
|
||||
|
||||
for _, change := range changes {
|
||||
@ -245,7 +245,7 @@ func (plan Plan) renderHuman(renderer Renderer, mode plans.Mode, opts ...plans.Q
|
||||
// so we need some extra context about what it would mean to
|
||||
// apply a change that _only_ includes output changes.
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\nYou can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.",
|
||||
"\nYou can apply this plan to save these new output values to the OpenTF state, without changing any real infrastructure.",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
}
|
||||
}
|
||||
@ -304,10 +304,10 @@ func renderHumanDiffDrift(renderer Renderer, diffs diffs, mode plans.Mode) bool
|
||||
return false
|
||||
}
|
||||
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[bold][cyan]Note:[reset][bold] Objects have changed outside of Terraform\n"))
|
||||
renderer.Streams.Print(renderer.Colorize.Color("\n[bold][cyan]Note:[reset][bold] Objects have changed outside of OpenTF\n"))
|
||||
renderer.Streams.Println()
|
||||
renderer.Streams.Print(format.WordWrap(
|
||||
"Terraform detected the following changes made outside of Terraform since the last \"terraform apply\" which may have affected this plan:\n",
|
||||
"OpenTF detected the following changes made outside of OpenTF since the last \"opentf apply\" which may have affected this plan:\n",
|
||||
renderer.Streams.Stdout.Columns()))
|
||||
|
||||
for _, drift := range drs {
|
||||
@ -321,7 +321,7 @@ func renderHumanDiffDrift(renderer Renderer, diffs diffs, mode plans.Mode) bool
|
||||
switch mode {
|
||||
case plans.RefreshOnlyMode:
|
||||
renderer.Streams.Println(format.WordWrap(
|
||||
"\n\nThis is a refresh-only plan, so Terraform will not take any actions to undo these. If you were expecting these changes then you can apply this plan to record the updated values in the Terraform state without changing any remote objects.",
|
||||
"\n\nThis is a refresh-only plan, so OpenTF will not take any actions to undo these. If you were expecting these changes then you can apply this plan to record the updated values in the OpenTF state without changing any remote objects.",
|
||||
renderer.Streams.Stdout.Columns(),
|
||||
))
|
||||
default:
|
||||
@ -395,7 +395,7 @@ func resourceChangeComment(resource jsonplan.ResourceChange, action plans.Action
|
||||
case plans.CreateThenDelete, plans.DeleteThenCreate:
|
||||
switch resource.ActionReason {
|
||||
case jsonplan.ResourceInstanceReplaceBecauseTainted:
|
||||
buf.WriteString(fmt.Sprintf("[bold] # %s[reset] is tainted, so must be [bold][red]replaced[reset]", dispAddr))
|
||||
buf.WriteString(fmt.Sprintf("[bold] # %s[reset] is tainted, so it must be [bold][red]replaced[reset]", dispAddr))
|
||||
case jsonplan.ResourceInstanceReplaceByRequest:
|
||||
buf.WriteString(fmt.Sprintf("[bold] # %s[reset] will be [bold][red]replaced[reset], as requested", dispAddr))
|
||||
case jsonplan.ResourceInstanceReplaceByTriggers:
|
||||
@ -426,7 +426,7 @@ func resourceChangeComment(resource jsonplan.ResourceChange, action plans.Action
|
||||
// FIXME: Ideally we'd truncate addr.Module to reflect the earliest
|
||||
// step that doesn't exist, so it's clearer which call this refers
|
||||
// to, but we don't have enough information out here in the UI layer
|
||||
// to decide that; only the "expander" in Terraform Core knows
|
||||
// to decide that; only the "expander" in OpenTF Core knows
|
||||
// which module instance keys are actually declared.
|
||||
buf.WriteString(fmt.Sprintf("\n # (because %s is not in configuration)", resource.ModuleAddress))
|
||||
case jsonplan.ResourceInstanceDeleteBecauseWrongRepetition:
|
||||
|
@ -863,7 +863,7 @@ new line`),
|
||||
RequiredReplace: cty.NewPathSet(cty.Path{
|
||||
cty.GetAttrStep{Name: "ami"},
|
||||
}),
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so must be replaced
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so it must be replaced
|
||||
-/+ resource "test_instance" "example" {
|
||||
~ ami = "ami-BEFORE" -> "ami-AFTER" # forces replacement
|
||||
~ id = "i-02ae66f368e8518a9" -> (known after apply)
|
||||
@ -5844,7 +5844,7 @@ func TestResourceChange_actionReason(t *testing.T) {
|
||||
After: nullVal,
|
||||
Schema: emptySchema,
|
||||
RequiredReplace: cty.NewPathSet(),
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so must be replaced
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so must it be replaced
|
||||
-/+ resource "test_instance" "example" {}`,
|
||||
},
|
||||
"replace because tainted (create first)": {
|
||||
@ -5855,7 +5855,7 @@ func TestResourceChange_actionReason(t *testing.T) {
|
||||
After: nullVal,
|
||||
Schema: emptySchema,
|
||||
RequiredReplace: cty.NewPathSet(),
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so must be replaced
|
||||
ExpectedOutput: ` # test_instance.example is tainted, so must it be replaced
|
||||
+/- resource "test_instance" "example" {}`,
|
||||
},
|
||||
"replace because cannot update (delete first)": {
|
||||
|
@ -45,7 +45,7 @@ replacing that object in a similar way to if you had specified that object's
|
||||
address using `-replace=...` as described above.
|
||||
|
||||
```
|
||||
# aws_instance.example is tainted, so must be replaced
|
||||
# aws_instance.example is tainted, so it must be replaced
|
||||
-/+ resource "aws_instance" "example" {
|
||||
# ...
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ For ease of consumption by callers, the plan representation includes a partial r
|
||||
// "action_reason" is some optional extra context about why the
|
||||
// actions given inside "change" were selected. This is the JSON
|
||||
// equivalent of annotations shown in the normal plan output like
|
||||
// "is tainted, so must be replaced" as opposed to just "must be
|
||||
// "is tainted, so it must be replaced" as opposed to just "must be
|
||||
// replaced".
|
||||
//
|
||||
// These reason codes are display hints only and the set of possible
|
||||
|
Loading…
Reference in New Issue
Block a user