lib/gitlab/qa/scenario/test/integration/praefect.rb in gitlab-qa-6.4.1 vs lib/gitlab/qa/scenario/test/integration/praefect.rb in gitlab-qa-6.5.0
- old
+ new
@@ -1,108 +1,65 @@
module Gitlab
module QA
module Scenario
module Test
module Integration
- class Praefect < Scenario::Template
- # rubocop:disable Metrics/AbcSize
- def perform(release, *rspec_args)
- Docker::Volumes.new.with_temporary_volumes do |volumes|
- # Create the Praefect database before enabling Praefect
- Component::Gitlab.perform do |gitlab|
- gitlab.release = QA::Release.new(release)
- gitlab.name = 'gitlab'
- gitlab.network = 'test'
- gitlab.volumes = volumes
- gitlab.exec_commands = [
- 'gitlab-psql -d template1 -c "CREATE DATABASE praefect_production OWNER gitlab"',
- 'mkdir -p /var/opt/gitlab/git-data/repositories/praefect',
- 'chown -R git:root /var/opt/gitlab/git-data/repositories'
- ]
+ class Praefect < GitalyCluster
+ attr_reader :gitlab_name, :spec_suite
- gitlab.act do
- prepare
- start
- reconfigure
- process_exec_commands
- wait_until_ready
- teardown!
- end
- end
+ def initialize
+ super
- # Restart GitLab with Praefect enabled and then run the tests
- Component::Gitlab.perform do |gitlab|
- gitlab.release = QA::Release.new(release)
- gitlab.name = 'gitlab'
- gitlab.network = 'test'
- gitlab.volumes = volumes
- gitlab.omnibus_config = omnibus_config_with_praefect
-
- gitlab.act do
- prepare_gitlab_omnibus_config
- start
- reconfigure
- wait_until_ready
-
- puts "Running Praefect specs!"
-
- Component::Specs.perform do |specs|
- specs.suite = 'Test::Instance::All'
- specs.release = gitlab.release
- specs.network = gitlab.network
- specs.args = [gitlab.address, *rspec_args]
- specs.env = { QA_PRAEFECT_REPOSITORY_STORAGE: 'default' }
- end
-
- teardown
- end
- end
- end
+ @tag = nil
+ @env = { QA_PRAEFECT_REPOSITORY_STORAGE: 'default' }
end
- # rubocop:enable Metrics/AbcSize
- private
-
- def omnibus_config_with_praefect
+ def gitlab_omnibus_configuration
<<~OMNIBUS
- gitaly['enable'] = true;
+ external_url 'http://#{@gitlab_name}.#{@network}';
+
+ git_data_dirs({
+ 'default' => {
+ 'gitaly_address' => 'tcp://#{@praefect_node_name}.#{@network}:2305',
+ 'gitaly_token' => 'PRAEFECT_EXTERNAL_TOKEN'
+ },
+ 'gitaly' => {
+ 'gitaly_address' => 'tcp://#{@gitlab_name}.#{@network}:8075',
+ 'path' => '/var/opt/gitlab/git-data'
+ }
+ });
gitaly['listen_addr'] = '0.0.0.0:8075';
gitaly['auth_token'] = 'secret-token';
gitaly['storage'] = [
{
- 'name' => 'praefect-gitaly-0',
- 'path' => '/var/opt/gitlab/git-data/repositories/praefect'
- },
- {
'name' => 'gitaly',
- 'path' => '/var/opt/gitlab/git-data/repositories/gitaly'
+ 'path' => '/var/opt/gitlab/git-data/repositories'
}
];
- praefect['enable'] = true;
- praefect['listen_addr'] = '0.0.0.0:2305';
- praefect['auth_token'] = 'secret-token';
- praefect['virtual_storages'] = {
- 'default' => {
- 'praefect-gitaly-0' => {
- 'address' => 'tcp://localhost:8075',
- 'token' => 'secret-token',
- 'primary' => true
- }
- }
- };
- praefect['database_host'] = '/var/opt/gitlab/postgresql';
- praefect['database_user'] = 'gitlab';
- praefect['database_dbname'] = 'praefect_production';
- praefect['postgres_queue_enabled'] = true;
gitlab_rails['gitaly_token'] = 'secret-token';
- git_data_dirs({
- 'default' => {
- 'gitaly_address' => 'tcp://localhost:2305'
+ gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN';
+ prometheus['scrape_configs'] = [
+ {
+ 'job_name' => 'praefect',
+ 'static_configs' => [
+ 'targets' => [
+ '#{@praefect_node_name}.#{@network}:9652'
+ ]
+ ]
},
- 'gitaly' => {
- 'path' => '/var/opt/gitlab/git-data/repositories/gitaly'
+ {
+ 'job_name' => 'praefect-gitaly',
+ 'static_configs' => [
+ 'targets' => [
+ '#{@primary_node_name}.#{@network}:9236',
+ '#{@secondary_node_name}.#{@network}:9236',
+ '#{@tertiary_node_name}.#{@network}:9236'
+ ]
+ ]
}
- });
+ ];
+ grafana['disable_login_form'] = false;
+ grafana['admin_password'] = 'GRAFANA_ADMIN_PASSWORD';
OMNIBUS
end
end
end
end