Class: Gitlab::QA::Component::Minio
- Inherits:
-
Object
- Object
- Gitlab::QA::Component::Minio
- Includes:
- Scenario::Actable
- Defined in:
- lib/gitlab/qa/component/minio.rb
Constant Summary collapse
- MINIO_IMAGE =
'minio/minio'.freeze
- MINIO_IMAGE_TAG =
'latest'.freeze
- AWS_ACCESS_KEY =
'AKIAIOSFODNN7EXAMPLE'.freeze
- AWS_SECRET_KEY =
'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'.freeze
- DATA_DIR =
'/data'.freeze
- DEFAULT_PORT =
9000
Instance Attribute Summary collapse
-
#docker ⇒ Object
readonly
Returns the value of attribute docker.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#name ⇒ Object
writeonly
Sets the attribute name.
-
#network ⇒ Object
Returns the value of attribute network.
-
#volumes ⇒ Object
Returns the value of attribute volumes.
Instance Method Summary collapse
- #add_bucket(name) ⇒ Object
-
#initialize ⇒ Minio
constructor
A new instance of Minio.
- #instance ⇒ Object
- #to_config ⇒ Object
Methods included from Scenario::Actable
Constructor Details
#initialize ⇒ Minio
Returns a new instance of Minio.
23 24 25 26 27 28 |
# File 'lib/gitlab/qa/component/minio.rb', line 23 def initialize @docker = Docker::Engine.new @environment = { MINIO_ACCESS_KEY: AWS_ACCESS_KEY, MINIO_SECRET_KEY: AWS_SECRET_KEY } @volumes = { host_data_dir => DATA_DIR } @buckets = [] end |
Instance Attribute Details
#docker ⇒ Object (readonly)
Returns the value of attribute docker.
19 20 21 |
# File 'lib/gitlab/qa/component/minio.rb', line 19 def docker @docker end |
#environment ⇒ Object
Returns the value of attribute environment.
20 21 22 |
# File 'lib/gitlab/qa/component/minio.rb', line 20 def environment @environment end |
#name=(value) ⇒ Object
Sets the attribute name
21 22 23 |
# File 'lib/gitlab/qa/component/minio.rb', line 21 def name=(value) @name = value end |
#network ⇒ Object
Returns the value of attribute network.
20 21 22 |
# File 'lib/gitlab/qa/component/minio.rb', line 20 def network @network end |
#volumes ⇒ Object
Returns the value of attribute volumes.
20 21 22 |
# File 'lib/gitlab/qa/component/minio.rb', line 20 def volumes @volumes end |
Instance Method Details
#add_bucket(name) ⇒ Object
41 42 43 |
# File 'lib/gitlab/qa/component/minio.rb', line 41 def add_bucket(name) @buckets << name end |
#instance ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gitlab/qa/component/minio.rb', line 30 def instance raise 'Please provide a block!' unless block_given? prepare start yield self ensure teardown end |
#to_config ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/gitlab/qa/component/minio.rb', line 45 def to_config config = YAML.safe_load <<~CFG provider: AWS aws_access_key_id: #{AWS_ACCESS_KEY} aws_secret_access_key: #{AWS_SECRET_KEY} aws_signature_version: 4 host: #{hostname} endpoint: http://#{hostname}:#{port} path_style: true CFG # Quotes get eaten up when the string is set in the environment config.to_s.gsub('"', '\\"') end |