Repository: jina-ai/jina
File: tests/unit/orchestrate/deployments/config/test_k8s_deployment_config.py (Python)

Code before:
        )
        assert service['metadata'] == {
            'name': service_gateway_name,
            'namespace': 'default-namespace',
            'labels': {'app': service_gateway_name},
        }
        spec_service = service['spec']
        assert spec_service['type'] == 'ClusterIP'
        assert len(spec_service['ports']) == 1
        actual_port = spec_service['ports'][0]
        assert actual_port['name'] == 'port'
        assert actual_port['protocol'] == 'TCP'
        assert actual_port['port'] == int(expected_port)
        assert actual_port['targetPort'] == int(expected_port)
        assert spec_service['selector'] == {'app': 'gateway'}

        assert spec_service['selector'] == {'app': 'gateway'}

    deployment = configs[1 + len(port)]
    assert deployment['kind'] == 'Deployment'
    assert deployment['metadata'] == {
        'name': 'gateway',
        'namespace': 'default-namespace',
    }
    spec_deployment = deployment['spec']
    assert spec_deployment['replicas'] == replicas  # no gateway replication for now
    assert spec_deployment['strategy'] == {
        'type': 'RollingUpdate',
        'rollingUpdate': {'maxSurge': 1, 'maxUnavailable': 0},
    }
    assert spec_deployment['selector'] == {'matchLabels': {'app': 'gateway'}}
    template = spec_deployment['template']
    assert template['metadata'] == {
        'labels': {
            'app': 'gateway',
            'jina_deployment_name': 'gateway',
            'shard_id': '',
            'pod_type': 'GATEWAY',
            'ns': 'default-namespace',
        },
        'annotations': {'linkerd.io/inject': 'enabled'},
    }
    spec = template['spec']
    containers = spec['containers']
    assert len(containers) == 1
    container = containers[0]
    assert container['name'] == 'gateway'
    assert (
        container['image'] == custom_gateway
        if custom_gateway
        else f'jinaai/jina:{deployment_config.worker_deployments[0].version}-py38-standard'

Review comment (suggestion):
```suggestion
    assert spec_deployment['replicas'] == replicas  # gateway replication is only enabled for k8s
```

Code after:
        )
        assert service['metadata'] == {
            'name': service_gateway_name,
            'namespace': 'default-namespace',
            'labels': {'app': service_gateway_name},
        }
        spec_service = service['spec']
        assert spec_service['type'] == 'ClusterIP'
        assert len(spec_service['ports']) == 1
        actual_port = spec_service['ports'][0]
        assert actual_port['name'] == 'port'
        assert actual_port['protocol'] == 'TCP'
        assert actual_port['port'] == int(expected_port)
        assert actual_port['targetPort'] == int(expected_port)
        assert spec_service['selector'] == {'app': 'gateway'}

        assert spec_service['selector'] == {'app': 'gateway'}

    deployment = configs[1 + len(port)]
    assert deployment['kind'] == 'Deployment'
    assert deployment['metadata'] == {
        'name': 'gateway',
        'namespace': 'default-namespace',
    }
    spec_deployment = deployment['spec']
    assert spec_deployment['replicas'] == replicas  # gateway replication is only enabled for k8s
    assert spec_deployment['strategy'] == {
        'type': 'RollingUpdate',
        'rollingUpdate': {'maxSurge': 1, 'maxUnavailable': 0},
    }
    assert spec_deployment['selector'] == {'matchLabels': {'app': 'gateway'}}
    template = spec_deployment['template']
    assert template['metadata'] == {
        'labels': {
            'app': 'gateway',
            'jina_deployment_name': 'gateway',
            'shard_id': '',
            'pod_type': 'GATEWAY',
            'ns': 'default-namespace',
        },
        'annotations': {'linkerd.io/inject': 'enabled'},
    }
    spec = template['spec']
    containers = spec['containers']
    assert len(containers) == 1
    container = containers[0]
    assert container['name'] == 'gateway'
    assert (
        container['image'] == custom_gateway
        if custom_gateway
        else f'jinaai/jina:{deployment_config.worker_deployments[0].version}-py38-standard'