Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit869058f

Browse files
authored
chore: add default events to the MockProvider's InvokeAction response (#37961)
1 parentb775ab5 commit869058f

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎internal/providers/testing/provider_mock.go‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"slices"
1010
"sync"
1111

12+
"github.com/hashicorp/hcl/v2"
1213
"github.com/zclconf/go-cty/cty"
1314
ctyjson"github.com/zclconf/go-cty/cty/json"
1415
"github.com/zclconf/go-cty/cty/msgpack"
1516

16-
"github.com/hashicorp/hcl/v2"
1717
"github.com/hashicorp/terraform/internal/configs/hcl2shim"
1818
"github.com/hashicorp/terraform/internal/providers"
1919
)
@@ -1148,7 +1148,7 @@ func (p *MockProvider) PlanAction(r providers.PlanActionRequest) (resp providers
11481148
returnresp
11491149
}
11501150

1151-
func (p*MockProvider)InvokeAction(r providers.InvokeActionRequest)(respproviders.InvokeActionResponse) {
1151+
func (p*MockProvider)InvokeAction(r providers.InvokeActionRequest) providers.InvokeActionResponse {
11521152
p.Lock()
11531153
deferp.Unlock()
11541154

@@ -1163,7 +1163,21 @@ func (p *MockProvider) InvokeAction(r providers.InvokeActionRequest) (resp provi
11631163
return*p.InvokeActionResponse
11641164
}
11651165

1166-
returnresp
1166+
events:= []providers.InvokeActionEvent{
1167+
providers.InvokeActionEvent_Progress{
1168+
Message:"Hello world!",
1169+
},
1170+
providers.InvokeActionEvent_Completed{},
1171+
}
1172+
return providers.InvokeActionResponse{
1173+
Events:func(yieldfunc(providers.InvokeActionEvent)bool) {
1174+
for_,event:=rangeevents {
1175+
if!yield(event) {
1176+
return
1177+
}
1178+
}
1179+
},
1180+
}
11671181
}
11681182

11691183
func (p*MockProvider)Close()error {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp