Skip to content

Commit

Permalink
corrected request payload
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads committed Aug 13, 2024
1 parent c73ed15 commit fdba138
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 0 additions & 7 deletions quest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ const (
events_count = "5"
)

type StreamHotTier struct {
Size string `json:"size"`
UsedSize *string `json:"used_size,omitempty"`
AvailableSize *string `json:"available_size,omitempty"`
OldestDateTimeEntry *string `json:"oldest_date_time_entry,omitempty"`
}

func TestSmokeListLogStream(t *testing.T) {
CreateStream(t, NewGlob.QueryClient, NewGlob.Stream)
req, err := NewGlob.QueryClient.NewRequest("GET", "logstream", nil)
Expand Down
16 changes: 15 additions & 1 deletion test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"fmt"
"io"
"math"
"os/exec"
"strings"
"testing"
Expand All @@ -33,6 +34,13 @@ const (
sleepDuration = 2 * time.Second
)

type StreamHotTier struct {
Size string `json:"size"`
UsedSize *string `json:"used_size,omitempty"`
AvailableSize *string `json:"available_size,omitempty"`
OldestDateTimeEntry *string `json:"oldest_date_time_entry,omitempty"`
}

func flogStreamFields() []string {
return []string{
"p_timestamp",
Expand Down Expand Up @@ -564,7 +572,13 @@ func checkAPIAccess(t *testing.T, client HTTPClient, stream string, role string)
}

func activateHotTier(t *testing.T) {
req, _ := NewGlob.QueryClient.NewRequest("PUT", "logstream/"+NewGlob.Stream+"/hottier", nil)
payload := StreamHotTier{
Size: fmt.Sprintf("%d", int64(20*math.Pow(1024, 3))), // set hot tier size to be 20 GB
}
json, _ := json.Marshal(payload)

req, _ := NewGlob.QueryClient.NewRequest("PUT", "logstream/"+NewGlob.Stream+"/hottier", bytes.NewBuffer(json))
req.Header.Set("Content-Type", "application/json")
response, err := NewGlob.QueryClient.Do(req)
body := readAsString(response.Body)

Expand Down

0 comments on commit fdba138

Please sign in to comment.