| ... | @@ -38,36 +38,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
... | @@ -38,36 +38,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
|
|
.and_return(double(execute: kubernetes_namespace))
|
|
.and_return(double(execute: kubernetes_namespace))
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context 'and the knative-serving namespace is missing' do
|
|
|
|
|
before do
|
|
|
|
|
allow(Clusters::KnativeServingNamespaceFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: false))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'and the knative-serving namespace exists' do
|
|
|
|
|
before do
|
|
|
|
|
allow(Clusters::KnativeServingNamespaceFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: true))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'and the knative version role binding is missing' do
|
|
|
|
|
before do
|
|
|
|
|
allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: nil))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it { is_expected.to be_truthy }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'and the knative version role binding already exists' do
|
|
|
|
|
before do
|
|
|
|
|
allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: true))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it { is_expected.to be_falsey }
|
|
it { is_expected.to be_falsey }
|
|
|
|
|
|
|
|
context 'and the service_account_token is blank' do
|
|
context 'and the service_account_token is blank' do
|
| ... | @@ -77,8 +47,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
... | @@ -77,8 +47,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'and no cluster to deploy to' do
|
|
context 'and no cluster to deploy to' do
|
|
|
let(:cluster) { nil }
|
|
let(:cluster) { nil }
|
| ... | @@ -188,24 +156,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
... | @@ -188,24 +156,6 @@ describe Gitlab::Ci::Build::Prerequisite::KubernetesNamespace do |
|
|
subject
|
|
subject
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context 'knative version role binding is missing' do
|
|
|
|
|
before do
|
|
|
|
|
allow(Clusters::KubernetesNamespaceFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: kubernetes_namespace))
|
|
|
|
|
allow(Clusters::KnativeVersionRoleBindingFinder).to receive(:new)
|
|
|
|
|
.and_return(double(execute: nil))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'creates the knative version role binding' do
|
|
|
|
|
expect(Clusters::Kubernetes::CreateOrUpdateNamespaceService)
|
|
|
|
|
.to receive(:new)
|
|
|
|
|
.with(cluster: cluster, kubernetes_namespace: kubernetes_namespace)
|
|
|
|
|
.and_return(service)
|
|
|
|
|
|
|
|
|
|
subject
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
context 'completion is not required' do
|
|
context 'completion is not required' do
|
| ... | |
... | |
| ... | | ... | |