Commit aa8a1b88 authored by Dan Davison's avatar Dan Davison

Merge branch 'refactor-monitor-to-k3s' into 'master'

Refactor monitor tests to use k3s

See merge request gitlab-org/gitlab!36207
parents 491ce8ff 01255cea
...@@ -20,7 +20,7 @@ module QA ...@@ -20,7 +20,7 @@ module QA
end end
def set_api_url(api_url) def set_api_url(api_url)
fill_in 'cluster_platform_kubernetes_attributes_api_url', with: api_url fill_in 'cluster_platform_kubernetes_attributes_api_url', with: QA::Runtime::Env.cluster_api_url || api_url
end end
def set_ca_certificate(ca_certificate) def set_ca_certificate(ca_certificate)
......
...@@ -107,6 +107,10 @@ module QA ...@@ -107,6 +107,10 @@ module QA
ENV['CI'] || ENV['CI_SERVER'] ENV['CI'] || ENV['CI_SERVER']
end end
def cluster_api_url
ENV['CLUSTER_API_URL']
end
def qa_cookies def qa_cookies
ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';') ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';')
end end
......
...@@ -10,6 +10,7 @@ module QA ...@@ -10,6 +10,7 @@ module QA
def setup def setup
@k3s = Service::DockerRun::K3s.new.tap do |k3s| @k3s = Service::DockerRun::K3s.new.tap do |k3s|
k3s.remove!
k3s.register! k3s.register!
shell "kubectl config set-cluster k3s --server https://#{k3s.host_name}:6443 --insecure-skip-tls-verify" shell "kubectl config set-cluster k3s --server https://#{k3s.host_name}:6443 --insecure-skip-tls-verify"
......
...@@ -33,7 +33,9 @@ module QA ...@@ -33,7 +33,9 @@ module QA
--name #{@name} --name #{@name}
--publish 6443:6443 --publish 6443:6443
--privileged --privileged
#{@image} server --cluster-secret some-secret #{@image} server
--cluster-secret some-secret
--no-deploy traefik
CMD CMD
command.gsub!("--network #{network} ", '') unless QA::Runtime::Env.running_in_ci? command.gsub!("--network #{network} ", '') unless QA::Runtime::Env.running_in_ci?
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
module QA module QA
RSpec.describe 'Monitor' do RSpec.describe 'Monitor' do
describe 'with Prometheus in a Gitlab-managed cluster', :orchestrated, :kubernetes do describe 'with Prometheus in a Gitlab-managed cluster', :orchestrated, :kubernetes, :requires_admin do
before :all do before :all do
@cluster = Service::KubernetesCluster.new.create! @cluster = Service::KubernetesCluster.new(provider_class: Service::ClusterProvider::K3s).create!
@project = Resource::Project.fabricate_via_api! do |project| @project = Resource::Project.fabricate_via_api! do |project|
project.name = 'monitoring-project' project.name = 'monitoring-project'
project.auto_devops_enabled = true project.auto_devops_enabled = true
......
...@@ -5,7 +5,7 @@ module QA ...@@ -5,7 +5,7 @@ module QA
RSpec.describe 'Monitor' do RSpec.describe 'Monitor' do
describe 'with Prometheus in a Gitlab-managed cluster', :orchestrated, :kubernetes do describe 'with Prometheus in a Gitlab-managed cluster', :orchestrated, :kubernetes do
before :all do before :all do
@cluster = Service::KubernetesCluster.new.create! @cluster = Service::KubernetesCluster.new(provider_class: Service::ClusterProvider::K3s).create!
@project = Resource::Project.fabricate_via_api! do |project| @project = Resource::Project.fabricate_via_api! do |project|
project.name = 'monitoring-project' project.name = 'monitoring-project'
project.auto_devops_enabled = true project.auto_devops_enabled = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment