Skip to content

Commit

Permalink
[FGS]:fix various methods (#650)
Browse files Browse the repository at this point in the history
[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
  • Loading branch information
artem-lifshits authored Apr 23, 2024
1 parent 9b4876d commit 1435832
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion acceptance/openstack/fgs/v2/functiongraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestFunctionGraphLifecycle(t *testing.T) {
updateFuncOpts := function.UpdateFuncCodeOpts{
FuncUrn: funcUrn,
CodeType: "inline",
FuncCode: function.FuncCode{
FuncCode: &function.FuncCode{
File: base64.StdEncoding.EncodeToString([]byte(appCode)),
},
}
Expand Down
3 changes: 2 additions & 1 deletion acceptance/openstack/fgs/v2/reserved_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients"
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/tools"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/common/pointerto"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/fgs/v2/function"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/fgs/v2/reserved"
th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
Expand Down Expand Up @@ -43,7 +44,7 @@ func TestFunctionGraphReservedLifecycle(t *testing.T) {
t.Logf("Attempting to UPDATE FUNCGRAPH RESERVED INSTANCES")
updateResp, err := reserved.Update(client, reserved.UpdateOpts{
FuncUrn: funcUrn,
Count: 1,
Count: pointerto.Int(1),
})
th.AssertNoErr(t, err)

Expand Down
12 changes: 6 additions & 6 deletions openstack/fgs/v2/function/UpdateCode.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
)

type UpdateFuncCodeOpts struct {
FuncUrn string `json:"-"`
CodeType string `json:"code_type" required:"true"`
CodeURL string `json:"code_url,omitempty"`
CodeFilename string `json:"code_filename,omitempty"`
FuncCode FuncCode `json:"func_code" required:"true"`
DependVersionList []string `json:"depend_version_list,omitempty"`
FuncUrn string `json:"-"`
CodeType string `json:"code_type" required:"true"`
CodeURL string `json:"code_url,omitempty"`
CodeFilename string `json:"code_filename,omitempty"`
FuncCode *FuncCode `json:"func_code,omitempty"`
DependVersionList []string `json:"depend_version_list,omitempty"`
}

func UpdateFuncCode(client *golangsdk.ServiceClient, opts UpdateFuncCodeOpts) (*FuncGraphCode, error) {
Expand Down
2 changes: 1 addition & 1 deletion openstack/fgs/v2/function/UpdateMaxInstances.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type UpdateFuncInstancesOpts struct {
FuncUrn string `json:"-"`
MaxInstanceNum int `json:"max_instance_num" required:"true"`
MaxInstanceNum int `json:"max_instance_num,omitempty"`
}

func UpdateMaxInstances(client *golangsdk.ServiceClient, opts UpdateFuncInstancesOpts) (*FuncGraph, error) {
Expand Down
4 changes: 2 additions & 2 deletions openstack/fgs/v2/reserved/Update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type UpdateOpts struct {
FuncUrn string `json:"-"`
Count int `json:"count" required:"true"`
Count *int `json:"count" required:"true"`
IdleMode *bool `json:"idle_mode"`
TacticsConfig *TacticsConfig `json:"tactics_config"`
}
Expand All @@ -19,7 +19,7 @@ type TacticsConfig struct {
type CronConfig struct {
Name string `json:"name,omitempty"`
Cron string `json:"cron,omitempty"`
Count string `json:"count,omitempty"`
Count int `json:"count,omitempty"`
StartTime int `json:"start_time,omitempty"`
ExpiredTime int `json:"expired_time,omitempty"`
}
Expand Down

0 comments on commit 1435832

Please sign in to comment.