summaryrefslogtreecommitdiff
path: root/spec/support/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/helpers')
-rw-r--r--spec/support/helpers/kubernetes_helpers.rb29
-rw-r--r--spec/support/helpers/position_tracer_helpers.rb2
2 files changed, 30 insertions, 1 deletions
diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb
index 677aef57661..cac43e94a92 100644
--- a/spec/support/helpers/kubernetes_helpers.rb
+++ b/spec/support/helpers/kubernetes_helpers.rb
@@ -194,6 +194,11 @@ module KubernetesHelpers
.to_return(kube_response({}))
end
+ def stub_kubeclient_put_cluster_role_binding(api_url, name)
+ WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/#{name}")
+ .to_return(kube_response({}))
+ end
+
def stub_kubeclient_get_role_binding(api_url, name, namespace: 'default')
WebMock.stub_request(:get, api_url + "/apis/rbac.authorization.k8s.io/v1/namespaces/#{namespace}/rolebindings/#{name}")
.to_return(kube_response({}))
@@ -219,11 +224,21 @@ module KubernetesHelpers
.to_return(kube_response({}))
end
+ def stub_kubeclient_get_namespaces(api_url)
+ WebMock.stub_request(:get, api_url + '/api/v1/namespaces')
+ .to_return(kube_response(kube_v1_namespace_list_body))
+ end
+
def stub_kubeclient_get_namespace(api_url, namespace: 'default')
WebMock.stub_request(:get, api_url + "/api/v1/namespaces/#{namespace}")
.to_return(kube_response({}))
end
+ def stub_kubeclient_put_cluster_role(api_url, name)
+ WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/clusterroles/#{name}")
+ .to_return(kube_response({}))
+ end
+
def stub_kubeclient_put_role(api_url, name, namespace: 'default')
WebMock.stub_request(:put, api_url + "/apis/rbac.authorization.k8s.io/v1/namespaces/#{namespace}/roles/#{name}")
.to_return(kube_response({}))
@@ -257,6 +272,20 @@ module KubernetesHelpers
}
end
+ def kube_v1_namespace_list_body
+ {
+ "kind" => "NamespaceList",
+ "apiVersion" => "v1",
+ "items" => [
+ {
+ "metadata" => {
+ "name" => "knative-serving"
+ }
+ }
+ ]
+ }
+ end
+
def kube_v1beta1_discovery_body
{
"kind" => "APIResourceList",
diff --git a/spec/support/helpers/position_tracer_helpers.rb b/spec/support/helpers/position_tracer_helpers.rb
index bbf6e06dd40..7516694d4fe 100644
--- a/spec/support/helpers/position_tracer_helpers.rb
+++ b/spec/support/helpers/position_tracer_helpers.rb
@@ -50,7 +50,7 @@ module PositionTracerHelpers
end
def create_branch(new_name, branch_name)
- CreateBranchService.new(project, current_user).execute(new_name, branch_name)
+ ::Branches::CreateService.new(project, current_user).execute(new_name, branch_name)
end
def create_file(branch_name, file_name, content)