summaryrefslogtreecommitdiff
path: root/qa/qa/service/praefect_manager.rb
blob: d8fa72456ad1e1adff99c4021a1be1931a6b2f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module QA
  module Service
    class PraefectManager
      include Service::Shellout

      def initialize
        @praefect = 'praefect'
        @first_node = 'gitaly1'
        @second_node = 'gitaly2'
        @primary_node = @first_node
        @secondary_node = @second_node
      end

      def stop_primary_node
        shell "docker stop #{@primary_node}"
        @secondary_node, @primary_node = @primary_node, @secondary_node
      end

      def reset
        shell "docker start #{@primary_node}"
        shell "docker start #{@secondary_node}"
      end
    end
  end
end