Skip to content

Commit

Permalink
Merge pull request #141 from HuiJing-C/master
Browse files Browse the repository at this point in the history
do not send hot_ttl when value = 0
  • Loading branch information
shabicheng authored Nov 18, 2021
2 parents 62909a9 + c5de5e3 commit 0ddd1c7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion log_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type LogStore struct {
MaxSplitShard int `json:"maxSplitShard"`
AppendMeta bool `json:"appendMeta"`
TelemetryType string `json:"telemetryType"`
HotTTL int `json:"hot_ttl"`
HotTTL uint32 `json:"hot_ttl,omitempty"`

CreateTime uint32 `json:"createTime,omitempty"`
LastModifyTime uint32 `json:"lastModifyTime,omitempty"`
Expand Down
33 changes: 33 additions & 0 deletions logstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ func createLogStore(s *LogstoreTestSuite) *LogStore {
return store
}

func (s *LogstoreTestSuite) TestCreateLogStoreWithNewRequestBody() {
client := CreateNormalInterface(s.endpoint, s.accessKeyID, s.accessKeySecret, "")
exist, ce := client.CheckProjectExist(s.projectName)
s.Nil(ce)
if !exist {
_, cpe := client.CreateProject(s.projectName, "go sdk test")
s.Nil(cpe)
}
defer client.DeleteProject(s.projectName)
logStore := &LogStore{
Name: s.logstoreName,
TTL: 7,
ShardCount: 2,
WebTracking: false,
AutoSplit: true,
MaxSplitShard: 16,
AppendMeta: false,
}
err := s.Project.CreateLogStoreV2(logStore)
s.Nil(err)
time.Sleep(time.Second * 10)
store, err := s.Project.GetLogStore(s.logstoreName)
s.Nil(err)
s.Equal(s.logstoreName, store.Name)
s.Equal(7, store.TTL)
s.Equal(2, store.ShardCount)
s.Equal(false, store.WebTracking)
s.Equal(true, store.AutoSplit)
s.Equal(16, store.MaxSplitShard)
s.Equal(false, store.AppendMeta)
s.Equal(uint32(0), store.HotTTL)
}

func (s *LogstoreTestSuite) TestCheckLogStore() {
store, err := s.Project.GetLogStore(s.logstoreName)
s.Nil(err)
Expand Down

0 comments on commit 0ddd1c7

Please sign in to comment.