Skip to content

Commit 8f99b21

Browse files
committed
test(cloudwatchlogs-loggroup): add property test coverage
1 parent d8ffbc5 commit 8f99b21

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package resources
2+
3+
import (
4+
"strconv"
5+
"testing"
6+
"time"
7+
8+
"github.com/gotidy/ptr"
9+
"github.com/stretchr/testify/assert"
10+
)
11+
12+
func TestCloudWatchLogsLogGroupProperties(t *testing.T) {
13+
now := time.Now().UTC()
14+
15+
r := &CloudWatchLogsLogGroup{
16+
Name: ptr.String("test-log-group"),
17+
CreatedTime: ptr.Int64(now.Unix()),
18+
CreationTime: ptr.Time(now),
19+
LastEvent: ptr.Time(now),
20+
RetentionInDays: 7,
21+
Tags: map[string]*string{
22+
"Environment": ptr.String("production"),
23+
},
24+
}
25+
26+
properties := r.Properties()
27+
assert.Equal(t, properties.Get("logGroupName"), "test-log-group")
28+
assert.Equal(t, properties.Get("Name"), "test-log-group")
29+
assert.Equal(t, properties.Get("CreatedTime"), strconv.Itoa(int(now.Unix())))
30+
assert.Equal(t, properties.Get("CreationTime"), now.Format(time.RFC3339))
31+
assert.Equal(t, properties.Get("LastEvent"), now.Format(time.RFC3339))
32+
assert.Equal(t, properties.Get("RetentionInDays"), "7")
33+
assert.Equal(t, properties.Get("tag:Environment"), "production")
34+
}

0 commit comments

Comments
 (0)