2020-05-06 17:14:53 +02:00
|
|
|
package azure
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TestGetContainerName ensures we can read container group name / container name from a containerID
|
|
|
|
func TestGetContainerName(t *testing.T) {
|
|
|
|
RegisterTestingT(t)
|
|
|
|
|
2020-05-18 14:56:32 +02:00
|
|
|
group, container := getGroupAndContainerName("docker1234")
|
2020-05-06 17:14:53 +02:00
|
|
|
Expect(group).To(Equal("docker1234"))
|
|
|
|
Expect(container).To(Equal(singleContainerName))
|
|
|
|
|
2020-05-18 14:56:32 +02:00
|
|
|
group, container = getGroupAndContainerName("compose_service1")
|
2020-05-06 17:14:53 +02:00
|
|
|
Expect(group).To(Equal("compose"))
|
|
|
|
Expect(container).To(Equal("service1"))
|
|
|
|
|
2020-05-18 14:56:32 +02:00
|
|
|
group, container = getGroupAndContainerName("compose_stack_service1")
|
2020-05-06 17:14:53 +02:00
|
|
|
Expect(group).To(Equal("compose_stack"))
|
|
|
|
Expect(container).To(Equal("service1"))
|
|
|
|
}
|