Skip to content

Commit

Permalink
fix (#633)
Browse files Browse the repository at this point in the history
[CTS]: traces v2 list fix

What this PR does / why we need it
Fix CTSv2 list func struct issue

Reviewed-by: Artem Sh.
  • Loading branch information
artem-lifshits authored Mar 14, 2024
1 parent 3f39e43 commit 35aa4e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
23 changes: 3 additions & 20 deletions acceptance/openstack/cts/v2/traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,24 @@ import (

"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients"
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/openstack/cts"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/cts/v1/tracker"
"github.com/opentelekomcloud/gophertelekomcloud/acceptance/tools"
"github.com/opentelekomcloud/gophertelekomcloud/openstack/cts/v2/traces"
th "github.com/opentelekomcloud/gophertelekomcloud/testhelper"
)

func TestTraces(t *testing.T) {
cv1, err := clients.NewCTSV1Client()
th.AssertNoErr(t, err)

bucketName := cts.CreateOBSBucket(t)
t.Cleanup(func() {
cts.DeleteOBSBucket(t, bucketName)
})

t.Logf("Attempting to create CTSv1 Tracker")
ctsTracker, err := tracker.Create(cv1, tracker.CreateOpts{
BucketName: bucketName,
})

t.Cleanup(func() {
t.Logf("Attempting to delete CTSv1 Tracker: %s", ctsTracker.TrackerName)
err := tracker.Delete(cv1, ctsTracker.TrackerName)
th.AssertNoErr(t, err)
t.Logf("Deleted CTSv1 Tracker: %s", ctsTracker.TrackerName)
})

th.AssertNoErr(t, err)
t.Logf("Created CTSv1 Tracker: %s", ctsTracker.TrackerName)

cv2, err := clients.NewCTSV2Client()
th.AssertNoErr(t, err)

list, err := traces.List(cv2, ctsTracker.TrackerName, traces.ListTracesOpts{})
list, err := traces.List(cv2, "system", traces.ListTracesOpts{})
th.AssertNoErr(t, err)

t.Logf("Number of Tracker Traces: %d", len(list.Traces))
th.AssertEquals(t, true, len(list.Traces) > 0)
tools.PrintResource(t, list)
}
2 changes: 1 addition & 1 deletion openstack/cts/v2/traces/List.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Traces struct {
// including letters, digits, hyphens (-), underscores (_), and periods (.). It must start with a letter.
TraceName string `json:"trace_name,omitempty"`
// Trace status. The value can be normal, warning, or incident.
TraceStatus string `q:"trace_status,omitempty"`
TraceStatus string `json:"trace_status,omitempty"`
// Trace source. The value can be ApiCall, ConsoleAction, or SystemAction.
TraceType string `json:"trace_type,omitempty"`
// Request of an operation on resources.
Expand Down

0 comments on commit 35aa4e2

Please sign in to comment.