fix the rpc diags tests
These weren't quite done, but got lost in the huge PR.
This commit is contained in:
parent
35dfac799e
commit
73474327a0
|
@ -12288,7 +12288,12 @@ resource "test_instance" "a" {
|
|||
|
||||
p := testProvider("test")
|
||||
p.PlanResourceChangeFn = testDiffFn
|
||||
p.ApplyResourceChangeFn = testApplyFn
|
||||
p.ApplyResourceChangeFn = func(req providers.ApplyResourceChangeRequest) (resp providers.ApplyResourceChangeResponse) {
|
||||
resp = testApplyFn(req)
|
||||
resp.Diagnostics = resp.Diagnostics.Append(tfdiags.SimpleWarning("don't frobble"))
|
||||
return resp
|
||||
}
|
||||
|
||||
p.GetSchemaReturn = &ProviderSchema{
|
||||
ResourceTypes: map[string]*configschema.Block{
|
||||
"test_instance": {
|
||||
|
@ -12299,10 +12304,6 @@ resource "test_instance" "a" {
|
|||
},
|
||||
}
|
||||
|
||||
p.ValidateResourceTypeConfigResponse = providers.ValidateResourceTypeConfigResponse{
|
||||
Diagnostics: tfdiags.Diagnostics(nil).Append(tfdiags.SimpleWarning("don't frobble")),
|
||||
}
|
||||
|
||||
ctx := testContext2(t, &ContextOpts{
|
||||
Config: m,
|
||||
Providers: map[addrs.Provider]providers.Factory{
|
||||
|
@ -12319,6 +12320,10 @@ resource "test_instance" "a" {
|
|||
t.Fatal(diags.Err())
|
||||
}
|
||||
|
||||
if len(diags) == 0 {
|
||||
t.Fatal("expected warnings")
|
||||
}
|
||||
|
||||
for _, d := range diags {
|
||||
des := d.Description().Summary
|
||||
if !strings.Contains(des, "frobble") {
|
||||
|
|
|
@ -6431,7 +6431,12 @@ resource "test_instance" "a" {
|
|||
})
|
||||
|
||||
p := testProvider("test")
|
||||
p.PlanResourceChangeFn = testDiffFn
|
||||
p.PlanResourceChangeFn = func(req providers.PlanResourceChangeRequest) providers.PlanResourceChangeResponse {
|
||||
resp := testDiffFn(req)
|
||||
resp.Diagnostics = resp.Diagnostics.Append(tfdiags.SimpleWarning("don't frobble"))
|
||||
return resp
|
||||
}
|
||||
|
||||
p.GetSchemaReturn = &ProviderSchema{
|
||||
ResourceTypes: map[string]*configschema.Block{
|
||||
"test_instance": {
|
||||
|
@ -6442,10 +6447,6 @@ resource "test_instance" "a" {
|
|||
},
|
||||
}
|
||||
|
||||
p.ValidateResourceTypeConfigResponse = providers.ValidateResourceTypeConfigResponse{
|
||||
Diagnostics: tfdiags.Diagnostics(nil).Append(tfdiags.SimpleWarning("don't herd cats")),
|
||||
}
|
||||
|
||||
ctx := testContext2(t, &ContextOpts{
|
||||
Config: m,
|
||||
Providers: map[addrs.Provider]providers.Factory{
|
||||
|
@ -6457,10 +6458,14 @@ resource "test_instance" "a" {
|
|||
t.Fatal(diags.Err())
|
||||
}
|
||||
|
||||
if len(diags) == 0 {
|
||||
t.Fatal("expected warnings")
|
||||
}
|
||||
|
||||
for _, d := range diags {
|
||||
des := d.Description().Summary
|
||||
if !strings.Contains(des, "cats") {
|
||||
t.Fatalf(`expected cats, got %q`, des)
|
||||
if !strings.Contains(des, "frobble") {
|
||||
t.Fatalf(`expected frobble, got %q`, des)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1831,6 +1831,10 @@ resource "test_instance" "a" {
|
|||
t.Fatal(diags.Err())
|
||||
}
|
||||
|
||||
if len(diags) == 0 {
|
||||
t.Fatal("expected warnings")
|
||||
}
|
||||
|
||||
for _, d := range diags {
|
||||
des := d.Description().Summary
|
||||
if !strings.Contains(des, "frobble") {
|
||||
|
|
Loading…
Reference in New Issue