Skip to content

Commit 1435832

Browse files
[FGS]:fix various methods (#650)
[FGS]:fix various methods What this PR does / why we need it Different fixes for TF Acceptance tests === RUN TestFunctionGraphReservedLifecycle reserved_test.go:44: Attempting to UPDATE FUNCGRAPH RESERVED INSTANCES tools.go:72: { "tactics_config": null, "idle_mode": false, "count": 1 } --- PASS: TestFunctionGraphReservedLifecycle (1.48s) PASS Process finished with the exit code 0 === RUN TestFunctionGraphLifecycle --- PASS: TestFunctionGraphLifecycle (2.48s) PASS Process finished with the exit code 0 Reviewed-by: Anton Sidelnikov
1 parent 9b4876d commit 1435832

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

acceptance/openstack/fgs/v2/functiongraph_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func TestFunctionGraphLifecycle(t *testing.T) {
4646
updateFuncOpts := function.UpdateFuncCodeOpts{
4747
FuncUrn: funcUrn,
4848
CodeType: "inline",
49-
FuncCode: function.FuncCode{
49+
FuncCode: &function.FuncCode{
5050
File: base64.StdEncoding.EncodeToString([]byte(appCode)),
5151
},
5252
}

acceptance/openstack/fgs/v2/reserved_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
88
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients"
99
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/tools"
10+
"github.com/opentelekomcloud/gophertelekomcloud/openstack/common/pointerto"
1011
"github.com/opentelekomcloud/gophertelekomcloud/openstack/fgs/v2/function"
1112
"github.com/opentelekomcloud/gophertelekomcloud/openstack/fgs/v2/reserved"
1213
th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
@@ -43,7 +44,7 @@ func TestFunctionGraphReservedLifecycle(t *testing.T) {
4344
t.Logf("Attempting to UPDATE FUNCGRAPH RESERVED INSTANCES")
4445
updateResp, err := reserved.Update(client, reserved.UpdateOpts{
4546
FuncUrn: funcUrn,
46-
Count: 1,
47+
Count: pointerto.Int(1),
4748
})
4849
th.AssertNoErr(t, err)
4950

openstack/fgs/v2/function/UpdateCode.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
)
88

99
type UpdateFuncCodeOpts struct {
10-
FuncUrn string `json:"-"`
11-
CodeType string `json:"code_type" required:"true"`
12-
CodeURL string `json:"code_url,omitempty"`
13-
CodeFilename string `json:"code_filename,omitempty"`
14-
FuncCode FuncCode `json:"func_code" required:"true"`
15-
DependVersionList []string `json:"depend_version_list,omitempty"`
10+
FuncUrn string `json:"-"`
11+
CodeType string `json:"code_type" required:"true"`
12+
CodeURL string `json:"code_url,omitempty"`
13+
CodeFilename string `json:"code_filename,omitempty"`
14+
FuncCode *FuncCode `json:"func_code,omitempty"`
15+
DependVersionList []string `json:"depend_version_list,omitempty"`
1616
}
1717

1818
func UpdateFuncCode(client *golangsdk.ServiceClient, opts UpdateFuncCodeOpts) (*FuncGraphCode, error) {

openstack/fgs/v2/function/UpdateMaxInstances.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
type UpdateFuncInstancesOpts struct {
1010
FuncUrn string `json:"-"`
11-
MaxInstanceNum int `json:"max_instance_num" required:"true"`
11+
MaxInstanceNum int `json:"max_instance_num,omitempty"`
1212
}
1313

1414
func UpdateMaxInstances(client *golangsdk.ServiceClient, opts UpdateFuncInstancesOpts) (*FuncGraph, error) {

openstack/fgs/v2/reserved/Update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
type UpdateOpts struct {
1010
FuncUrn string `json:"-"`
11-
Count int `json:"count" required:"true"`
11+
Count *int `json:"count" required:"true"`
1212
IdleMode *bool `json:"idle_mode"`
1313
TacticsConfig *TacticsConfig `json:"tactics_config"`
1414
}
@@ -19,7 +19,7 @@ type TacticsConfig struct {
1919
type CronConfig struct {
2020
Name string `json:"name,omitempty"`
2121
Cron string `json:"cron,omitempty"`
22-
Count string `json:"count,omitempty"`
22+
Count int `json:"count,omitempty"`
2323
StartTime int `json:"start_time,omitempty"`
2424
ExpiredTime int `json:"expired_time,omitempty"`
2525
}

0 commit comments

Comments
 (0)