Skip to content

Commit

Permalink
Merge pull request #256 from 3pillarlabs/develop
Browse files Browse the repository at this point in the history
Merge dev PRs
  • Loading branch information
sayantam authored Oct 23, 2021
2 parents b8eaa35 + 41d131c commit d29b1a7
Show file tree
Hide file tree
Showing 55 changed files with 1,462 additions and 573 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
- "start.sh"

hailstorm-api:
image: "hailstorm3/hailstorm-api:1.0.19"
image: "hailstorm3/hailstorm-api:1.0.21"
ports:
- "4567:8080"
environment:
Expand Down
2 changes: 1 addition & 1 deletion hailstorm-api/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

gem 'activerecord-jdbcmysql-adapter', '~> 60.2'
gem 'hailstorm', '= 5.1.14'
gem 'hailstorm', '= 5.1.16'
gem 'httparty', '~> 0.18.1'
gem 'puma'
gem 'rake', '~> 13'
Expand Down
30 changes: 15 additions & 15 deletions hailstorm-api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ GEM
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
ast (2.4.1)
aws-eventstream (1.1.0)
aws-partitions (1.350.0)
aws-sdk-core (3.104.3)
aws-eventstream (1.1.1)
aws-partitions (1.476.0)
aws-sdk-core (3.116.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-ec2 (1.182.0)
aws-sdk-core (~> 3, >= 3.99.0)
aws-sdk-ec2 (1.248.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.1)
aws-sigv4 (1.2.4)
aws-eventstream (~> 1, >= 1.0.2)
builder (3.2.4)
columnize (0.9.0)
Expand All @@ -50,10 +50,10 @@ GEM
croaky-rspec (0.2.0)
diff-lcs (1.4.4)
docile (1.3.2)
erubi (1.9.0)
erubi (1.10.0)
erubis (2.7.0)
haikunator (1.1.0)
hailstorm (5.1.14-java)
haikunator (1.1.1)
hailstorm (5.1.16-java)
actionpack (~> 6.0.0)
activerecord-jdbc-adapter (~> 60.2)
aws-sdk-ec2 (~> 1)
Expand All @@ -73,7 +73,7 @@ GEM
jmespath (1.4.0)
json (2.3.1-java)
linecache (1.3.1-java)
loofah (2.6.0)
loofah (2.10.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mime-types (3.3.1)
Expand All @@ -87,7 +87,7 @@ GEM
net-ssh (>= 5.0.0, < 7.0.0)
net-ssh (5.0.2)
nio4r (2.5.2-java)
nokogiri (1.10.9-java)
nokogiri (1.10.10-java)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
Expand All @@ -96,8 +96,8 @@ GEM
rack (2.2.3)
rack-protection (2.0.8.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -139,7 +139,7 @@ GEM
ruby-debug-base (0.11.0-java)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
rubyzip (2.3.0)
rubyzip (2.3.2)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand All @@ -166,7 +166,7 @@ PLATFORMS
DEPENDENCIES
activerecord-jdbcmysql-adapter (~> 60.2)
croaky-rspec (~> 0.1)
hailstorm (= 5.1.14)
hailstorm (= 5.1.16)
httparty (~> 0.18.1)
puma
rake (~> 13)
Expand Down
2 changes: 1 addition & 1 deletion hailstorm-api/app/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Version
module Hailstorm
module Api
VERSION = '1.0.19'
VERSION = '1.0.21'
end
end
7 changes: 4 additions & 3 deletions hailstorm-cli/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
hailstorm-cli (1.0.16-java)
hailstorm (= 5.1.14)
hailstorm-cli (1.0.18-java)
hailstorm (= 5.1.16)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -94,7 +94,7 @@ GEM
erubis (2.7.0)
ffi (1.13.1-java)
haikunator (1.1.1)
hailstorm (5.1.14-java)
hailstorm (5.1.16-java)
actionpack (~> 6.0.0)
activerecord-jdbc-adapter (~> 60.2)
aws-sdk-ec2 (~> 1)
Expand Down Expand Up @@ -191,6 +191,7 @@ GEM
PLATFORMS
java
universal-java-1.8
universal-java-11

DEPENDENCIES
activerecord-jdbcmysql-adapter (~> 60.2)
Expand Down
2 changes: 1 addition & 1 deletion hailstorm-cli/hailstorm-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ and generate reports.'
gem.executables = gem.files.grep(%r{^bin/\b}).map { |f| File.basename(f) }
gem.require_paths = %w[lib]

gem.add_runtime_dependency('hailstorm', '= 5.1.14')
gem.add_runtime_dependency('hailstorm', '= 5.1.16')
end
2 changes: 1 addition & 1 deletion hailstorm-cli/lib/hailstorm/cli/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Version
module Hailstorm
module Cli
VERSION = '1.0.16'
VERSION = '1.0.18'
end
end
1 change: 1 addition & 0 deletions hailstorm-gem/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage/
features/data/data-center-machines.yml
features/data/site_server.txt
/pkg/
/features/data/feature-parameters.yml
2 changes: 1 addition & 1 deletion hailstorm-gem/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
hailstorm (5.1.14-java)
hailstorm (5.1.16-java)
actionpack (~> 6.0.0)
activerecord-jdbc-adapter (~> 60.2)
aws-sdk-ec2 (~> 1)
Expand Down
24 changes: 24 additions & 0 deletions hailstorm-gem/features/clean_aws_account.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: Clean AWS Account
Background: Hailstorm application is initialized
Given Hailstorm is initialized with a project 'clean_aws_account'

Scenario: Purge a previously deleted AWS cluster
Given a previously deleted AWS cluster is configured in any region
When the AWS cluster is purged
Then the AMI is deleted from the AWS cluster model

@delete_untagged_resources
Scenario: Purge an AWS cluster with untagged resources
Given AWS untagged resources with prefix 'purge-aws-account-feature' in a region with a public subnet
And an AWS cluster configured with these resources
When the AWS cluster is purged
Then the AMI is deleted from the AWS cluster model
But the AWS resources are not deleted

Scenario: Purge an AWS cluster with tagged resources
Given JMeter is correctly configured
And an AWS cluster and resources created by Hailstorm in a clean region
And the created resources are tagged
When the AWS cluster is purged
Then the AMI is deleted from the AWS cluster model
And the AWS resources are deleted as well
5 changes: 5 additions & 0 deletions hailstorm-gem/features/data/feature-parameters.sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copy me to feature-parameters.yml
---
clean_aws_account:
region_with_public_subnet: ap-south-1
clean_region: ap-south-1
105 changes: 105 additions & 0 deletions hailstorm-gem/features/step_definitions/aws_model_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# frozen_string_literal: true

After do |scenario|
if scenario.source_tag_names.include?('@terminate_instance') && @aws
if @load_agent
terminate_agents(@aws.region, @load_agent)
elsif @project
terminate_agents(@aws.region, *@project.load_agents)
end

@aws.cleanup
end
end

Given(/^Amazon is chosen as the cluster$/) do
require 'hailstorm/model/amazon_cloud'
@aws = Hailstorm::Model::AmazonCloud.new
@aws.project = @project
@aws.access_key, @aws.secret_key = aws_keys
@aws.active = true
end

When(/^I choose '(.+?)' region$/) do |region|
@aws.region = region
aws_region_helper = Hailstorm::Model::Helper::AwsRegionHelper.new
@ami_id = aws_region_helper.region_base_ami_map[@aws.region]
expect(@ami_id).to_not be_nil
end

When(/^(?:I |)create the AMI$/) do
expect(@aws).to be_valid
@aws.send(:create_security_group)
@aws.send(:create_agent_ami)
end

Then(/^the AMI to be created would be named '(.+?)'$/) do |expected_ami_name|
actual_ami_name = @aws.send(:ami_id)
expect(actual_ami_name).to eq(expected_ami_name)
end

And(/^instance type is '(.+?)'$/) do |instance_type|
@aws.instance_type = instance_type
end

Given(/^a(?:n| previously deleted) AWS cluster is configured in (?:any|'(.+?)') region$/) do |region_code|
require 'hailstorm/model/amazon_cloud'
@aws = Hailstorm::Model::AmazonCloud.new
@aws.project = @project
@aws.access_key, @aws.secret_key = aws_keys
@aws.region = region_code || 'ap-northeast-1'
@aws.active = false
@aws.agent_ami = 'ami-123'
@aws.save!
@aws.update_column(:active, true)

require 'hailstorm/model/cluster'
Hailstorm::Model::Cluster.create!(project: @project,
cluster_type: @aws.class.name,
clusterable_id: @aws.id)
end

When(/^the AWS cluster is purged$/) do
@project.purge_clusters
end

Then(/^the AMI is deleted from the AWS cluster model$/) do
if @aws
@aws.reload
else
@aws = @project.clusters[0].cluster_instance
end

expect(@aws.agent_ami).to be_nil
end

And(/^an AWS cluster configured with these resources$/) do
access_key, secret_key = aws_keys
aws = create_aws_cluster(@project,
access_key: access_key,
secret_key: secret_key,
ssh_identity: @untagged_resource_group[:key_pair].key_name,
region: @untagged_resource_group[:region],
agent_ami: @untagged_resource_group[:agent_ami].id,
user_name: 'ec2-user',
security_group: @untagged_resource_group[:security_group].group_name,
instance_type: 't3a.nano',
max_threads_per_agent: 5,
vpc_subnet_id: @untagged_resource_group[:subnet_id])

create_load_agent(aws, @untagged_resource_group[:instance])
@project.reload
end

Given(/^an AWS cluster and resources created by Hailstorm in a clean region$/) do
region_code = feature_parameter(feature: 'clean_aws_account', param: 'clean_region')
@hailstorm_config.clusters('amazon_cloud') do |aws|
aws.access_key, aws.secret_key = aws_keys
aws.region = region_code
aws.active = true
aws.instance_type = 't3a.nano'
end

@project.settings_modified = true
@project.setup(config: @hailstorm_config)
end
Loading

0 comments on commit d29b1a7

Please sign in to comment.