mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-18 23:06:10 -05:00
* feat: Add new tests for insecure registries. * chore: Refactor code into parseImageOptions and add tests. * feat: normalizeRegistryAddress supports http addresses. * feat: keys of authConfigs are now stored without protocol. * chore: Refactor of docker registry fallback in parseImageOptions. * refactor: Improve tests and implementation of parseImageOptions * feat: Implement support for http registries. * fix: authConfig unit tests now reflect newest structure. * fix: docker_image_registry data source can pull without authentication. * fix: Refactor setup of http headers for registry requests. * docs: Add note about http registries. * docs: Fix linting error in docs.
32 lines
955 B
Go
32 lines
955 B
Go
package provider
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestNormalizeRegistryAddress(t *testing.T) {
|
|
t.Run("Should return same address if http:// is used", func(t *testing.T) {
|
|
address := "http://registry.com"
|
|
expected := "http://registry.com"
|
|
actual := normalizeRegistryAddress(address)
|
|
if actual != expected {
|
|
t.Fatalf("Expected %s, got %s", expected, actual)
|
|
}
|
|
})
|
|
t.Run("Should return https address if no protocol is specified", func(t *testing.T) {
|
|
address := "registry.com"
|
|
expected := "https://registry.com"
|
|
actual := normalizeRegistryAddress(address)
|
|
if actual != expected {
|
|
t.Fatalf("Expected %s, got %s", expected, actual)
|
|
}
|
|
})
|
|
t.Run("Should return https address if https protocol is specified", func(t *testing.T) {
|
|
address := "https://registry.com"
|
|
expected := "https://registry.com"
|
|
actual := normalizeRegistryAddress(address)
|
|
if actual != expected {
|
|
t.Fatalf("Expected %s, got %s", expected, actual)
|
|
}
|
|
})
|
|
}
|