ey-core 3.4.4 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -3
- data/bin/ey-core +8 -0
- data/features/environment_variables.feature +54 -0
- data/features/step_definitions/accounts_steps.rb +14 -0
- data/features/step_definitions/applications_steps.rb +7 -14
- data/features/step_definitions/environment_variables_steps.rb +51 -0
- data/features/step_definitions/environments_steps.rb +15 -0
- data/features/support/environment_variable_helpers.rb +20 -0
- data/features/support/resource_helpers.rb +12 -0
- data/lib/ey-core/cli/environment_variables.rb +71 -0
- data/lib/ey-core/cli/helpers/core.rb +29 -0
- data/lib/ey-core/cli/main.rb +2 -0
- data/lib/ey-core/cli/servers.rb +34 -17
- data/lib/ey-core/client.rb +23 -0
- data/lib/ey-core/client/mock.rb +3 -0
- data/lib/ey-core/collections/auto_scaling_alarms.rb +8 -0
- data/lib/ey-core/collections/auto_scaling_policies.rb +33 -0
- data/lib/ey-core/collections/environment_variables.rb +8 -0
- data/lib/ey-core/models/address.rb +2 -0
- data/lib/ey-core/models/application.rb +1 -0
- data/lib/ey-core/models/auto_scaling_alarm.rb +54 -0
- data/lib/ey-core/models/auto_scaling_group.rb +26 -0
- data/lib/ey-core/models/base_auto_scaling_policy.rb +61 -0
- data/lib/ey-core/models/environment.rb +53 -47
- data/lib/ey-core/models/environment_variable.rb +29 -0
- data/lib/ey-core/models/request.rb +4 -0
- data/lib/ey-core/models/simple_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/models/step_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/models/target_auto_scaling_policy.rb +24 -0
- data/lib/ey-core/requests/create_account.rb +5 -0
- data/lib/ey-core/requests/create_address.rb +1 -0
- data/lib/ey-core/requests/create_application.rb +8 -7
- data/lib/ey-core/requests/create_auto_scaling_alarm.rb +69 -0
- data/lib/ey-core/requests/create_auto_scaling_policy.rb +68 -0
- data/lib/ey-core/requests/create_environment.rb +2 -1
- data/lib/ey-core/requests/create_environment_variable.rb +39 -0
- data/lib/ey-core/requests/create_user.rb +8 -6
- data/lib/ey-core/requests/destroy_auto_scaling_alarm.rb +49 -0
- data/lib/ey-core/requests/destroy_auto_scaling_policy.rb +49 -0
- data/lib/ey-core/requests/get_applications.rb +1 -1
- data/lib/ey-core/requests/get_auto_scaling_alarm.rb +27 -0
- data/lib/ey-core/requests/get_auto_scaling_alarms.rb +34 -0
- data/lib/ey-core/requests/get_auto_scaling_policies.rb +46 -0
- data/lib/ey-core/requests/get_auto_scaling_policy.rb +27 -0
- data/lib/ey-core/requests/get_environment_variable.rb +19 -0
- data/lib/ey-core/requests/get_environment_variables.rb +29 -0
- data/lib/ey-core/requests/get_environments.rb +1 -1
- data/lib/ey-core/requests/update_auto_scaling_alarm.rb +45 -0
- data/lib/ey-core/requests/update_auto_scaling_policy.rb +46 -0
- data/lib/ey-core/requests/update_environment_variable.rb +25 -0
- data/lib/ey-core/test_helpers.rb +2 -0
- data/lib/ey-core/test_helpers/auto_scaling_helpers.rb +35 -0
- data/lib/ey-core/version.rb +1 -1
- data/spec/addresses_spec.rb +2 -1
- data/spec/auto_scaling_alarms_spec.rb +40 -0
- data/spec/auto_scaling_policies_spec.rb +94 -0
- data/spec/spec_helper.rb +7 -0
- metadata +37 -2
@@ -0,0 +1,94 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Auto scaling policies" do
|
4
|
+
let!(:client) { create_client }
|
5
|
+
let!(:account) { create_account(client: client) }
|
6
|
+
let!(:environment) { create_environment(account: account) }
|
7
|
+
let(:auto_scaling_group) { create_auto_scaling_group(environment: environment.id) }
|
8
|
+
let(:simple_policy_params) do
|
9
|
+
{
|
10
|
+
name: SecureRandom.hex(16),
|
11
|
+
action_value: 2,
|
12
|
+
action_type: "add",
|
13
|
+
action_unit: "instances",
|
14
|
+
auto_scaling_group_id: auto_scaling_group.id,
|
15
|
+
type: "simple"
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "common requests for all policy types" do
|
20
|
+
let!(:policy) { client.auto_scaling_policies.create!(simple_policy_params).resource! }
|
21
|
+
|
22
|
+
it "is able to retrieve auto scaling policy by it's id" do
|
23
|
+
found_policy = client.auto_scaling_policies.get(policy.id)
|
24
|
+
expect(found_policy).not_to be_nil
|
25
|
+
expect(found_policy.id).to eq(policy.id)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "updates auto scaling policy" do
|
29
|
+
expect do
|
30
|
+
policy.update(name: "new name")
|
31
|
+
end.to change { policy.name }.to("new name")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "destroys a policy by it's id" do
|
35
|
+
expect do
|
36
|
+
policy.destroy!
|
37
|
+
end.to change { auto_scaling_group.reload.simple_auto_scaling_policies.count }.from(1).to(0)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "simple autoscaling policy" do
|
42
|
+
it "adds one to autoscaling group" do
|
43
|
+
expect {
|
44
|
+
client.auto_scaling_policies.create!(simple_policy_params)
|
45
|
+
}.to change { auto_scaling_group.reload.simple_auto_scaling_policies.count }.from(0).to(1)
|
46
|
+
.and not_change { auto_scaling_group.reload.step_auto_scaling_policies.count }
|
47
|
+
.and not_change { auto_scaling_group.reload.target_auto_scaling_policies.count }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "target tracking auto scaling policy" do
|
52
|
+
let(:params) do
|
53
|
+
{
|
54
|
+
auto_scaling_group_id: auto_scaling_group.id,
|
55
|
+
name: SecureRandom.hex(16),
|
56
|
+
target_value: 0.7,
|
57
|
+
estimated_warmup: 200,
|
58
|
+
metric_type: "avg_cup",
|
59
|
+
disable_scale_in: false,
|
60
|
+
type: "target"
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
it "adds one to autoscaling group" do
|
65
|
+
expect {
|
66
|
+
client.auto_scaling_policies.create!(params)
|
67
|
+
}.to change { auto_scaling_group.reload.target_auto_scaling_policies.count }.from(0).to(1)
|
68
|
+
.and not_change { auto_scaling_group.reload.simple_auto_scaling_policies.count }
|
69
|
+
.and not_change { auto_scaling_group.reload.step_auto_scaling_policies.count }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "step auto scaling policy" do
|
74
|
+
let(:params) do
|
75
|
+
{
|
76
|
+
auto_scaling_group_id: auto_scaling_group.id,
|
77
|
+
name: SecureRandom.hex(16),
|
78
|
+
estimated_warmup: 200,
|
79
|
+
action_unit: "instances",
|
80
|
+
action_type: "add",
|
81
|
+
steps: [{ metric_from: 50, metric_to: nil, action_value: 1 }],
|
82
|
+
type: "step"
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
it "adds one to autoscaling group" do
|
87
|
+
expect {
|
88
|
+
client.auto_scaling_policies.create!(params)
|
89
|
+
}.to change { auto_scaling_group.reload.step_auto_scaling_policies.count }.from(0).to(1)
|
90
|
+
.and not_change { auto_scaling_group.reload.simple_auto_scaling_policies.count }
|
91
|
+
.and not_change { auto_scaling_group.reload.target_auto_scaling_policies.count }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,4 +17,11 @@ RSpec.configure do |config|
|
|
17
17
|
$stdin = STDIN
|
18
18
|
$stderr = STDERR
|
19
19
|
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# This allows to have not_change matcher, i.e.
|
23
|
+
#
|
24
|
+
# expect { something }.to change { other_thing }
|
25
|
+
# .and not_change { completely_other_things }
|
26
|
+
RSpec::Matchers.define_negated_matcher :not_change, :change
|
20
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Engine Yard Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -403,6 +403,7 @@ files:
|
|
403
403
|
- features/accounts.feature
|
404
404
|
- features/applications.feature
|
405
405
|
- features/current_user.feature
|
406
|
+
- features/environment_variables.feature
|
406
407
|
- features/environments.feature
|
407
408
|
- features/init.feature
|
408
409
|
- features/login.feature
|
@@ -411,6 +412,7 @@ files:
|
|
411
412
|
- features/step_definitions/applications_steps.rb
|
412
413
|
- features/step_definitions/current_user_steps.rb
|
413
414
|
- features/step_definitions/deprecated_command_steps.rb
|
415
|
+
- features/step_definitions/environment_variables_steps.rb
|
414
416
|
- features/step_definitions/environments_steps.rb
|
415
417
|
- features/step_definitions/version_steps.rb
|
416
418
|
- features/support/account_helpers.rb
|
@@ -423,6 +425,7 @@ files:
|
|
423
425
|
- features/support/deployment_helpers.rb
|
424
426
|
- features/support/env.rb
|
425
427
|
- features/support/environment_helpers.rb
|
428
|
+
- features/support/environment_variable_helpers.rb
|
426
429
|
- features/support/fake_kernel.rb
|
427
430
|
- features/support/io.rb
|
428
431
|
- features/support/mock_api.rb
|
@@ -439,6 +442,7 @@ files:
|
|
439
442
|
- lib/ey-core/cli/console.rb
|
440
443
|
- lib/ey-core/cli/current_user.rb
|
441
444
|
- lib/ey-core/cli/deploy.rb
|
445
|
+
- lib/ey-core/cli/environment_variables.rb
|
442
446
|
- lib/ey-core/cli/environments.rb
|
443
447
|
- lib/ey-core/cli/errors.rb
|
444
448
|
- lib/ey-core/cli/help.rb
|
@@ -485,7 +489,9 @@ files:
|
|
485
489
|
- lib/ey-core/collections/application_archives.rb
|
486
490
|
- lib/ey-core/collections/application_deployments.rb
|
487
491
|
- lib/ey-core/collections/applications.rb
|
492
|
+
- lib/ey-core/collections/auto_scaling_alarms.rb
|
488
493
|
- lib/ey-core/collections/auto_scaling_groups.rb
|
494
|
+
- lib/ey-core/collections/auto_scaling_policies.rb
|
489
495
|
- lib/ey-core/collections/backup_files.rb
|
490
496
|
- lib/ey-core/collections/blueprints.rb
|
491
497
|
- lib/ey-core/collections/components.rb
|
@@ -499,6 +505,7 @@ files:
|
|
499
505
|
- lib/ey-core/collections/database_services.rb
|
500
506
|
- lib/ey-core/collections/deployments.rb
|
501
507
|
- lib/ey-core/collections/environment_plan_usages.rb
|
508
|
+
- lib/ey-core/collections/environment_variables.rb
|
502
509
|
- lib/ey-core/collections/environments.rb
|
503
510
|
- lib/ey-core/collections/features.rb
|
504
511
|
- lib/ey-core/collections/firewall_rules.rb
|
@@ -549,8 +556,10 @@ files:
|
|
549
556
|
- lib/ey-core/models/application.rb
|
550
557
|
- lib/ey-core/models/application_archive.rb
|
551
558
|
- lib/ey-core/models/application_deployment.rb
|
559
|
+
- lib/ey-core/models/auto_scaling_alarm.rb
|
552
560
|
- lib/ey-core/models/auto_scaling_group.rb
|
553
561
|
- lib/ey-core/models/backup_file.rb
|
562
|
+
- lib/ey-core/models/base_auto_scaling_policy.rb
|
554
563
|
- lib/ey-core/models/billing.rb
|
555
564
|
- lib/ey-core/models/blueprint.rb
|
556
565
|
- lib/ey-core/models/component.rb
|
@@ -565,6 +574,7 @@ files:
|
|
565
574
|
- lib/ey-core/models/deployment.rb
|
566
575
|
- lib/ey-core/models/environment.rb
|
567
576
|
- lib/ey-core/models/environment_plan_usage.rb
|
577
|
+
- lib/ey-core/models/environment_variable.rb
|
568
578
|
- lib/ey-core/models/feature.rb
|
569
579
|
- lib/ey-core/models/firewall.rb
|
570
580
|
- lib/ey-core/models/firewall_rule.rb
|
@@ -587,10 +597,13 @@ files:
|
|
587
597
|
- lib/ey-core/models/server_event.rb
|
588
598
|
- lib/ey-core/models/server_usage.rb
|
589
599
|
- lib/ey-core/models/service.rb
|
600
|
+
- lib/ey-core/models/simple_auto_scaling_policy.rb
|
590
601
|
- lib/ey-core/models/ssl_certificate.rb
|
602
|
+
- lib/ey-core/models/step_auto_scaling_policy.rb
|
591
603
|
- lib/ey-core/models/storage.rb
|
592
604
|
- lib/ey-core/models/storage_user.rb
|
593
605
|
- lib/ey-core/models/support_trial.rb
|
606
|
+
- lib/ey-core/models/target_auto_scaling_policy.rb
|
594
607
|
- lib/ey-core/models/task.rb
|
595
608
|
- lib/ey-core/models/token.rb
|
596
609
|
- lib/ey-core/models/untracked_address.rb
|
@@ -615,12 +628,15 @@ files:
|
|
615
628
|
- lib/ey-core/requests/create_alert.rb
|
616
629
|
- lib/ey-core/requests/create_application.rb
|
617
630
|
- lib/ey-core/requests/create_application_archive.rb
|
631
|
+
- lib/ey-core/requests/create_auto_scaling_alarm.rb
|
618
632
|
- lib/ey-core/requests/create_auto_scaling_group.rb
|
633
|
+
- lib/ey-core/requests/create_auto_scaling_policy.rb
|
619
634
|
- lib/ey-core/requests/create_backup_file.rb
|
620
635
|
- lib/ey-core/requests/create_database_server.rb
|
621
636
|
- lib/ey-core/requests/create_database_service.rb
|
622
637
|
- lib/ey-core/requests/create_database_service_snapshot.rb
|
623
638
|
- lib/ey-core/requests/create_environment.rb
|
639
|
+
- lib/ey-core/requests/create_environment_variable.rb
|
624
640
|
- lib/ey-core/requests/create_firewall.rb
|
625
641
|
- lib/ey-core/requests/create_firewall_rule.rb
|
626
642
|
- lib/ey-core/requests/create_keypair.rb
|
@@ -644,7 +660,9 @@ files:
|
|
644
660
|
- lib/ey-core/requests/deploy_environment_application.rb
|
645
661
|
- lib/ey-core/requests/deprovision_environment.rb
|
646
662
|
- lib/ey-core/requests/destroy_addon.rb
|
663
|
+
- lib/ey-core/requests/destroy_auto_scaling_alarm.rb
|
647
664
|
- lib/ey-core/requests/destroy_auto_scaling_group.rb
|
665
|
+
- lib/ey-core/requests/destroy_auto_scaling_policy.rb
|
648
666
|
- lib/ey-core/requests/destroy_blueprint.rb
|
649
667
|
- lib/ey-core/requests/destroy_database_server.rb
|
650
668
|
- lib/ey-core/requests/destroy_database_server_snapshot.rb
|
@@ -687,8 +705,12 @@ files:
|
|
687
705
|
- lib/ey-core/requests/get_application_deployment.rb
|
688
706
|
- lib/ey-core/requests/get_application_deployments.rb
|
689
707
|
- lib/ey-core/requests/get_applications.rb
|
708
|
+
- lib/ey-core/requests/get_auto_scaling_alarm.rb
|
709
|
+
- lib/ey-core/requests/get_auto_scaling_alarms.rb
|
690
710
|
- lib/ey-core/requests/get_auto_scaling_group.rb
|
691
711
|
- lib/ey-core/requests/get_auto_scaling_groups.rb
|
712
|
+
- lib/ey-core/requests/get_auto_scaling_policies.rb
|
713
|
+
- lib/ey-core/requests/get_auto_scaling_policy.rb
|
692
714
|
- lib/ey-core/requests/get_backup_file.rb
|
693
715
|
- lib/ey-core/requests/get_backup_files.rb
|
694
716
|
- lib/ey-core/requests/get_billing.rb
|
@@ -715,6 +737,8 @@ files:
|
|
715
737
|
- lib/ey-core/requests/get_environment_database_services.rb
|
716
738
|
- lib/ey-core/requests/get_environment_logical_databases.rb
|
717
739
|
- lib/ey-core/requests/get_environment_plan_usages.rb
|
740
|
+
- lib/ey-core/requests/get_environment_variable.rb
|
741
|
+
- lib/ey-core/requests/get_environment_variables.rb
|
718
742
|
- lib/ey-core/requests/get_environments.rb
|
719
743
|
- lib/ey-core/requests/get_feature.rb
|
720
744
|
- lib/ey-core/requests/get_features.rb
|
@@ -794,11 +818,14 @@ files:
|
|
794
818
|
- lib/ey-core/requests/update_address.rb
|
795
819
|
- lib/ey-core/requests/update_alert.rb
|
796
820
|
- lib/ey-core/requests/update_application_archive.rb
|
821
|
+
- lib/ey-core/requests/update_auto_scaling_alarm.rb
|
797
822
|
- lib/ey-core/requests/update_auto_scaling_group.rb
|
823
|
+
- lib/ey-core/requests/update_auto_scaling_policy.rb
|
798
824
|
- lib/ey-core/requests/update_billing.rb
|
799
825
|
- lib/ey-core/requests/update_blueprint.rb
|
800
826
|
- lib/ey-core/requests/update_connector.rb
|
801
827
|
- lib/ey-core/requests/update_environment.rb
|
828
|
+
- lib/ey-core/requests/update_environment_variable.rb
|
802
829
|
- lib/ey-core/requests/update_membership.rb
|
803
830
|
- lib/ey-core/requests/update_provider_location.rb
|
804
831
|
- lib/ey-core/requests/update_server.rb
|
@@ -812,6 +839,7 @@ files:
|
|
812
839
|
- lib/ey-core/test_helpers.rb
|
813
840
|
- lib/ey-core/test_helpers/account_helpers.rb
|
814
841
|
- lib/ey-core/test_helpers/alert_helpers.rb
|
842
|
+
- lib/ey-core/test_helpers/auto_scaling_helpers.rb
|
815
843
|
- lib/ey-core/test_helpers/client_helpers.rb
|
816
844
|
- lib/ey-core/test_helpers/cucumber.rb
|
817
845
|
- lib/ey-core/test_helpers/resource_helpers.rb
|
@@ -827,7 +855,9 @@ files:
|
|
827
855
|
- spec/alerts_spec.rb
|
828
856
|
- spec/application_archives_spec.rb
|
829
857
|
- spec/applications_spec.rb
|
858
|
+
- spec/auto_scaling_alarms_spec.rb
|
830
859
|
- spec/auto_scaling_groups_spec.rb
|
860
|
+
- spec/auto_scaling_policies_spec.rb
|
831
861
|
- spec/billing_spec.rb
|
832
862
|
- spec/blueprints_spec.rb
|
833
863
|
- spec/client_spec.rb
|
@@ -911,6 +941,7 @@ test_files:
|
|
911
941
|
- features/accounts.feature
|
912
942
|
- features/applications.feature
|
913
943
|
- features/current_user.feature
|
944
|
+
- features/environment_variables.feature
|
914
945
|
- features/environments.feature
|
915
946
|
- features/init.feature
|
916
947
|
- features/login.feature
|
@@ -919,6 +950,7 @@ test_files:
|
|
919
950
|
- features/step_definitions/applications_steps.rb
|
920
951
|
- features/step_definitions/current_user_steps.rb
|
921
952
|
- features/step_definitions/deprecated_command_steps.rb
|
953
|
+
- features/step_definitions/environment_variables_steps.rb
|
922
954
|
- features/step_definitions/environments_steps.rb
|
923
955
|
- features/step_definitions/version_steps.rb
|
924
956
|
- features/support/account_helpers.rb
|
@@ -931,6 +963,7 @@ test_files:
|
|
931
963
|
- features/support/deployment_helpers.rb
|
932
964
|
- features/support/env.rb
|
933
965
|
- features/support/environment_helpers.rb
|
966
|
+
- features/support/environment_variable_helpers.rb
|
934
967
|
- features/support/fake_kernel.rb
|
935
968
|
- features/support/io.rb
|
936
969
|
- features/support/mock_api.rb
|
@@ -948,7 +981,9 @@ test_files:
|
|
948
981
|
- spec/alerts_spec.rb
|
949
982
|
- spec/application_archives_spec.rb
|
950
983
|
- spec/applications_spec.rb
|
984
|
+
- spec/auto_scaling_alarms_spec.rb
|
951
985
|
- spec/auto_scaling_groups_spec.rb
|
986
|
+
- spec/auto_scaling_policies_spec.rb
|
952
987
|
- spec/billing_spec.rb
|
953
988
|
- spec/blueprints_spec.rb
|
954
989
|
- spec/client_spec.rb
|