github.com/defang-io/defang/src@v0.0.0-20240505002154-bdf411911834/pkg/clouds/aws/ecs/logs_test.go (about) 1 package ecs 2 3 import ( 4 "testing" 5 ) 6 7 func TestLogGroupIdentifier(t *testing.T) { 8 arn := "arn:aws:logs:us-west-2:123456789012:log-group:/LOG/GROUP/NAME:*" 9 expected := "arn:aws:logs:us-west-2:123456789012:log-group:/LOG/GROUP/NAME" 10 if got := getLogGroupIdentifier(arn); got != expected { 11 t.Errorf("Expected %q, but got %q", expected, got) 12 } 13 if got := getLogGroupIdentifier(expected); got != expected { 14 t.Errorf("Expected %q, but got %q", expected, got) 15 } 16 } 17 18 func TestSplitClusterTask(t *testing.T) { 19 taskArn := "arn:aws:ecs:us-west-2:123456789012:task/cluster-name/12345678123412341234123456789012" 20 expectedClusterName := "cluster-name" 21 22 clusterName, taskID := SplitClusterTask(&taskArn) 23 24 if clusterName != expectedClusterName { 25 t.Errorf("Expected cluster name %q, but got %q", expectedClusterName, clusterName) 26 } 27 if taskID != "12345678123412341234123456789012" { 28 t.Errorf("Expected task ID %q, but got %q", taskArn, taskID) 29 } 30 }