  def testDeploymentReplicaSetError(self, mock_list_replica_set):
    """Test error is raised if no ReplicaSet matches Deployment."""
    mock_list_replica_set.return_value.items = [
        k8s_mocks.V1ReplicaSet(name='replicaset-0', template_spec_labels={}),
    ]

    deployment = workloads.K8sDeployment(
        k8s_mocks.MOCK_API_CLIENT, 'deployment', 'default')
    with mock.patch.object(deployment, 'Read') as mock_deployment_read:
      mock_deployment_read.return_value = k8s_mocks.V1Deployment(
          template_spec_labels={'app': 'nginx'},
          # Match labels are not important here since API return value is
          # predefined
          match_labels={})
      self.assertRaises(errors.ResourceNotFoundError, deployment._ReplicaSet)  # pylint: disable=protected-access
Test error is raised if no ReplicaSet matches Deployment.
tests/providers/kubernetes/test_workloads.py