def test_patch_containers():
    deploy = get_deployment()
    c = Component("service/test-service")
    c.image_prefix = ""
    c.image = "test-image"
    c.tag = "v6.6.6"
    c._patch_containers(deploy)

    container = deploy["spec"]["template"]["spec"]["containers"][0]
    assert container["image"] == "test-image:v6.6.6"
Esempio n. 2
0
def test_patch_containers_with_default_tag():
    deploy = get_deployment()
    c = Component("service/test-service")
    c.image_prefix = ""

    c._patch_containers(deploy)
    container = deploy["spec"]["template"]["spec"]["containers"][0]
    assert (
        container["image"] == "imagined.registry.tld/myproj-service-test-deployment:v1"
    )

    c.tag = "v2"
    c._patch_containers(deploy)
    container = deploy["spec"]["template"]["spec"]["containers"][0]
    assert (
        container["image"] == "imagined.registry.tld/myproj-service-test-deployment:v2"
    )