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 =
These are secrets used in a local Minio container, they’re not used for any online S3 server.
'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.
24 25 26 27 28 29 |
# File 'lib/gitlab/qa/component/minio.rb', line 24 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.
20 21 22 |
# File 'lib/gitlab/qa/component/minio.rb', line 20 def docker @docker end |
#environment ⇒ Object
Returns the value of attribute environment.
21 22 23 |
# File 'lib/gitlab/qa/component/minio.rb', line 21 def environment @environment end |
#name=(value) ⇒ Object
Sets the attribute name
22 23 24 |
# File 'lib/gitlab/qa/component/minio.rb', line 22 def name=(value) @name = value end |
#network ⇒ Object
Returns the value of attribute network.
21 22 23 |
# File 'lib/gitlab/qa/component/minio.rb', line 21 def network @network end |
#volumes ⇒ Object
Returns the value of attribute volumes.
21 22 23 |
# File 'lib/gitlab/qa/component/minio.rb', line 21 def volumes @volumes end |
Instance Method Details
#add_bucket(name) ⇒ Object
42 43 44 |
# File 'lib/gitlab/qa/component/minio.rb', line 42 def add_bucket(name) @buckets << name end |
#instance ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gitlab/qa/component/minio.rb', line 31 def instance raise 'Please provide a block!' unless block_given? prepare start yield self ensure teardown end |
#to_config ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gitlab/qa/component/minio.rb', line 46 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 |