gooddata 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +0 -0
- data/.flayignore +2 -0
- data/.travis.yml +24 -7
- data/.yardopts +0 -0
- data/CHANGELOG.md +125 -1
- data/CLI.md +0 -0
- data/Dockerfile.jruby +7 -2
- data/Dockerfile.ruby +1 -1
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/Rakefile +23 -9
- data/TODO.md +0 -0
- data/bin/gitflow-init.sh +8 -0
- data/ci.rake +3 -3
- data/data/2008.crt +39 -0
- data/data/new_ca.cer +22 -0
- data/dependency_decisions.yml +0 -0
- data/docker-compose.lcm.yml +31 -0
- data/docker-compose.yml +4 -2
- data/gooddata.gemspec +3 -3
- data/lcm.rake +288 -0
- data/lib/gooddata.rb +1 -0
- data/lib/gooddata/bricks/base_downloader.rb +1 -1
- data/lib/gooddata/bricks/brick.rb +0 -1
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
- data/lib/gooddata/bricks/pipeline.rb +67 -0
- data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
- data/lib/gooddata/bricks/release_brick.rb +18 -0
- data/lib/gooddata/bricks/rollout_brick.rb +14 -0
- data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
- data/lib/gooddata/bricks/users_brick.rb +13 -0
- data/lib/gooddata/core/logging.rb +1 -1
- data/lib/gooddata/exceptions/maql_execution.rb +1 -1
- data/lib/gooddata/extensions/string.rb +0 -0
- data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
- data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
- data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
- data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
- data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
- data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
- data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
- data/lib/gooddata/lcm/lcm2.rb +0 -2
- data/lib/gooddata/lcm/types/special/enum.rb +6 -0
- data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
- data/lib/gooddata/lcm/types/special/types.rb +1 -1
- data/lib/gooddata/mixins/is_folder.rb +0 -0
- data/lib/gooddata/mixins/to_json.rb +0 -0
- data/lib/gooddata/mixins/uri_getter.rb +0 -0
- data/lib/gooddata/models/project_creator.rb +38 -30
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
- data/lib/gooddata/rest/README.md +0 -0
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/bricks/brick.rb.erb +0 -0
- data/lib/templates/bricks/main.rb.erb +0 -0
- data/lib/templates/project/Goodfile.erb +0 -0
- data/lib/templates/project/data/commits.csv +0 -0
- data/lib/templates/project/data/devs.csv +0 -0
- data/lib/templates/project/data/repos.csv +0 -0
- data/lib/templates/project/model/model.rb.erb +0 -0
- metadata +21 -451
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
- data/spec/.rubocop.yml +0 -16
- data/spec/bricks/bricks_spec.rb +0 -110
- data/spec/bricks/default-config.json +0 -8
- data/spec/data/.gooddata +0 -4
- data/spec/data/blueprints/additional_dataset_module.json +0 -32
- data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
- data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
- data/spec/data/blueprints/invalid_blueprint.json +0 -103
- data/spec/data/blueprints/m_n_model.json +0 -104
- data/spec/data/blueprints/model_module.json +0 -25
- data/spec/data/blueprints/test_blueprint.json +0 -39
- data/spec/data/blueprints/test_project_model_spec.json +0 -106
- data/spec/data/cc/data/source/commits.csv +0 -4
- data/spec/data/cc/data/source/devs.csv +0 -4
- data/spec/data/cc/data/source/repos.csv +0 -3
- data/spec/data/cc/devel.prm +0 -0
- data/spec/data/cc/graph/graph.grf +0 -11
- data/spec/data/cc/workspace.prm +0 -19
- data/spec/data/column_based_permissions.csv +0 -7
- data/spec/data/column_based_permissions2.csv +0 -6
- data/spec/data/dynamic_schedule_params_table.csv +0 -7
- data/spec/data/gd_gse_data_blueprint.json +0 -1371
- data/spec/data/gd_gse_data_manifest.json +0 -1424
- data/spec/data/gd_gse_data_model.json +0 -1772
- data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
- data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
- data/spec/data/hello_world_process/hello_world.rb +0 -9
- data/spec/data/hello_world_process/hello_world.zip +0 -0
- data/spec/data/integration_model.json +0 -252
- data/spec/data/integration_policies.csv +0 -9134
- data/spec/data/line_based_permissions.csv +0 -3
- data/spec/data/manifests/test_blueprint.json +0 -32
- data/spec/data/manifests/test_project.json +0 -107
- data/spec/data/reports/left_attr_report.json +0 -108
- data/spec/data/reports/metric_only_one_line.json +0 -83
- data/spec/data/reports/report_1.json +0 -197
- data/spec/data/reports/top_attr_report.json +0 -108
- data/spec/data/ruby_params_process/ruby_params.rb +0 -9
- data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
- data/spec/data/ruby_process/process.rb +0 -8
- data/spec/data/ruby_process/stuff.txt +0 -1
- data/spec/data/superfluous_titles_view.json +0 -81
- data/spec/data/test-ci-data.csv +0 -2
- data/spec/data/user_filters.csv +0 -2
- data/spec/data/users.csv +0 -12
- data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
- data/spec/data/wire_models/model_view.json +0 -1775
- data/spec/data/wire_models/nu_model.json +0 -3046
- data/spec/data/wire_models/test_blueprint.json +0 -66
- data/spec/data/wire_test_project.json +0 -150
- data/spec/data/workspace_table.csv +0 -3
- data/spec/environment/default.rb +0 -43
- data/spec/environment/development.rb +0 -32
- data/spec/environment/environment.rb +0 -38
- data/spec/environment/production.rb +0 -27
- data/spec/environment/staging.rb +0 -32
- data/spec/environment/testing.rb +0 -32
- data/spec/helpers/appstore_project_helper.rb +0 -221
- data/spec/helpers/blueprint_helper.rb +0 -27
- data/spec/helpers/cli_helper.rb +0 -38
- data/spec/helpers/connection_helper.rb +0 -43
- data/spec/helpers/constants.rb +0 -32
- data/spec/helpers/crypto_helper.rb +0 -19
- data/spec/helpers/csv_helper.rb +0 -20
- data/spec/helpers/process_helper.rb +0 -35
- data/spec/helpers/project_helper.rb +0 -74
- data/spec/helpers/schedule_helper.rb +0 -33
- data/spec/helpers/spec_helper.rb +0 -17
- data/spec/integration/ads_output_stage_spec.rb +0 -45
- data/spec/integration/blueprint_updates_spec.rb +0 -107
- data/spec/integration/blueprint_with_ca_spec.rb +0 -56
- data/spec/integration/blueprint_with_grain_spec.rb +0 -74
- data/spec/integration/channel_configuration_spec.rb +0 -67
- data/spec/integration/clients_spec.rb +0 -164
- data/spec/integration/command_datawarehouse_spec.rb +0 -45
- data/spec/integration/command_projects_spec.rb +0 -32
- data/spec/integration/commands/command_projects_spec.rb +0 -22
- data/spec/integration/connection_spec.rb +0 -37
- data/spec/integration/core/connection_spec.rb +0 -56
- data/spec/integration/core/logging_spec.rb +0 -132
- data/spec/integration/core/project_spec.rb +0 -54
- data/spec/integration/create_from_template_spec.rb +0 -29
- data/spec/integration/create_project_spec.rb +0 -27
- data/spec/integration/date_dim_switch_spec.rb +0 -154
- data/spec/integration/deprecated_load_spec.rb +0 -60
- data/spec/integration/full_process_schedule_spec.rb +0 -367
- data/spec/integration/full_project_spec.rb +0 -592
- data/spec/integration/helpers_spec.rb +0 -16
- data/spec/integration/lcm_spec.rb +0 -54
- data/spec/integration/mandatory_user_filter_spec.rb +0 -53
- data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
- data/spec/integration/models/data_product_spec.rb +0 -71
- data/spec/integration/models/domain_spec.rb +0 -162
- data/spec/integration/models/invitation_spec.rb +0 -17
- data/spec/integration/models/label_spec.rb +0 -49
- data/spec/integration/models/membership_spec.rb +0 -127
- data/spec/integration/models/metadata/report_spec.rb +0 -54
- data/spec/integration/models/metric_spec.rb +0 -24
- data/spec/integration/models/params_spec.rb +0 -118
- data/spec/integration/models/process_spec.rb +0 -35
- data/spec/integration/models/profile_spec.rb +0 -210
- data/spec/integration/models/project_role_spec.rb +0 -94
- data/spec/integration/models/project_spec.rb +0 -225
- data/spec/integration/models/schedule_spec.rb +0 -477
- data/spec/integration/models/unit_project_spec.rb +0 -130
- data/spec/integration/over_to_user_filters_spec.rb +0 -98
- data/spec/integration/partial_md_export_import_spec.rb +0 -41
- data/spec/integration/project_spec.rb +0 -381
- data/spec/integration/rest_spec.rb +0 -214
- data/spec/integration/schedule_spec.rb +0 -611
- data/spec/integration/segments_spec.rb +0 -100
- data/spec/integration/subscription_spec.rb +0 -88
- data/spec/integration/urn_date_dim_spec.rb +0 -53
- data/spec/integration/user_filters_spec.rb +0 -310
- data/spec/integration/user_group_spec.rb +0 -147
- data/spec/integration/variables_spec.rb +0 -189
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
- data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
- data/spec/logging_in_logging_out_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -110
- data/spec/unit/actions/associate_clients_spec.rb +0 -48
- data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
- data/spec/unit/actions/collect_clients_spec.rb +0 -65
- data/spec/unit/actions/collect_data_product_spec.rb +0 -58
- data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
- data/spec/unit/actions/collect_meta_spec.rb +0 -88
- data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
- data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
- data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
- data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
- data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
- data/spec/unit/actions/execute_schedules_spec.rb +0 -94
- data/spec/unit/actions/provision_clients_spec.rb +0 -46
- data/spec/unit/actions/purge_clients_spec.rb +0 -47
- data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
- data/spec/unit/actions/segments_filter_spec.rb +0 -46
- data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
- data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
- data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
- data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
- data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
- data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
- data/spec/unit/actions/synchronize_users_spec.rb +0 -180
- data/spec/unit/bricks/bricks_spec.rb +0 -34
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
- data/spec/unit/cli/cli_spec.rb +0 -17
- data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
- data/spec/unit/core/nil_logger_spec.rb +0 -13
- data/spec/unit/extensions/hash_spec.rb +0 -22
- data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
- data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
- data/spec/unit/helpers/check_helper_spec.rb +0 -134
- data/spec/unit/helpers/csv_helper_spec.rb +0 -22
- data/spec/unit/helpers/data_helper_spec.rb +0 -67
- data/spec/unit/helpers/global_helpers_spec.rb +0 -264
- data/spec/unit/helpers_spec.rb +0 -254
- data/spec/unit/lcm/lcm2_spec.rb +0 -100
- data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
- data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
- data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
- data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
- data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
- data/spec/unit/models/blueprint/reference_spec.rb +0 -28
- data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
- data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
- data/spec/unit/models/dataset_blueprint.rb +0 -14
- data/spec/unit/models/execution_spec.rb +0 -109
- data/spec/unit/models/from_wire_spec.rb +0 -321
- data/spec/unit/models/metadata_spec.rb +0 -140
- data/spec/unit/models/metric_spec.rb +0 -129
- data/spec/unit/models/model_spec.rb +0 -87
- data/spec/unit/models/project_creator_spec.rb +0 -90
- data/spec/unit/models/project_spec.rb +0 -94
- data/spec/unit/models/report_result_data_spec.rb +0 -194
- data/spec/unit/models/to_manifest_spec.rb +0 -165
- data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
- data/spec/unit/models/user_filters_spec.rb +0 -95
- data/spec/unit/models/variable_spec.rb +0 -280
- data/spec/unit/rest/phmap_spec.rb +0 -117
- data/spec/unit/rest/polling_spec.rb +0 -101
- data/spec/unit/rest/resource_spec.rb +0 -10
- data/spec/vcr_configurer.rb +0 -63
@@ -1,88 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/collect_meta'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
describe GoodData::LCM2::CollectMeta do
|
11
|
-
let(:development_client) { double('development_client') }
|
12
|
-
let(:dashboard) { double('dashboard', uri: 'tagged/dashboard/uri') }
|
13
|
-
|
14
|
-
before do
|
15
|
-
allow(development_client).to receive(:projects).and_return({})
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when no production tag configured' do
|
19
|
-
let(:params) do
|
20
|
-
params = {
|
21
|
-
development_client: development_client,
|
22
|
-
synchronize: [{ from: 'project_id' }]
|
23
|
-
}
|
24
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'retrieves all dashboards' do
|
28
|
-
expect(GoodData::Dashboard).to receive(:all).and_return({})
|
29
|
-
expect(GoodData::MdObject).to receive(:query).and_return({})
|
30
|
-
subject.class.call(params)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when global production tag configured' do
|
35
|
-
let(:params) do
|
36
|
-
params = {
|
37
|
-
development_client: development_client,
|
38
|
-
synchronize: [{ from: 'project_id' }],
|
39
|
-
production_tags: 'production_tag'
|
40
|
-
}
|
41
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'retrieves dashboards by the specified tag' do
|
45
|
-
expect(GoodData::Dashboard).to receive(:find_by_tag)
|
46
|
-
.with(['production_tag'], any_args)
|
47
|
-
.and_return({})
|
48
|
-
subject.class.call(params)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'when segment-specific production tag configured' do
|
53
|
-
let(:params) do
|
54
|
-
params = {
|
55
|
-
development_client: development_client,
|
56
|
-
synchronize: [{ from: 'project_id' }],
|
57
|
-
segments: [{ production_tags: 'segment_production_tag' }, {}]
|
58
|
-
}
|
59
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'retrieves dashboards by the specified tag' do
|
63
|
-
expect(GoodData::Dashboard).to receive(:find_by_tag)
|
64
|
-
.with(['segment_production_tag'], any_args)
|
65
|
-
.and_return({})
|
66
|
-
subject.class.call(params)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'when both global and segment-specific production tags configured' do
|
71
|
-
let(:params) do
|
72
|
-
params = {
|
73
|
-
development_client: development_client,
|
74
|
-
synchronize: [{ from: 'project_id' }],
|
75
|
-
segments: [{ production_tags: 'segment_production_tag' }, {}],
|
76
|
-
production_tags: 'production_tag'
|
77
|
-
}
|
78
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'preffers segment-specific tags' do
|
82
|
-
expect(GoodData::Dashboard).to receive(:find_by_tag)
|
83
|
-
.with(%w(segment_production_tag), any_args)
|
84
|
-
.and_return({})
|
85
|
-
subject.class.call(params)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/collect_segment_clients'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
describe GoodData::LCM2::CollectSegmentClients do
|
11
|
-
let(:gdc_gd_client) { double('gdc_gd_client') }
|
12
|
-
let(:domain) { double('domain') }
|
13
|
-
let(:segment) { double('segment') }
|
14
|
-
let(:segments) { [segment] }
|
15
|
-
let(:client) { double('client') }
|
16
|
-
let(:clients) { [client] }
|
17
|
-
|
18
|
-
before do
|
19
|
-
allow(gdc_gd_client).to receive(:domain).and_return(domain)
|
20
|
-
allow(domain).to receive(:segments).and_return(segments)
|
21
|
-
allow(segment).to receive(:clients).and_return(clients)
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'when client has no project in segments' do
|
25
|
-
let(:params) do
|
26
|
-
params = {
|
27
|
-
gdc_gd_client: gdc_gd_client,
|
28
|
-
synchronize: [{}],
|
29
|
-
segments: [{}]
|
30
|
-
}
|
31
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
32
|
-
end
|
33
|
-
|
34
|
-
before do
|
35
|
-
allow(client).to receive(:project?).and_return(false)
|
36
|
-
allow(client).to receive(:client_id).and_return('my_client_id')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'raise error' do
|
40
|
-
expect { subject.class.call(params) }.to raise_error
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'when client has project in segments' do
|
45
|
-
let(:segment) { double('segment') }
|
46
|
-
let(:project) { double('project') }
|
47
|
-
let(:ads_client) { double('ads_client') }
|
48
|
-
let(:ads_response) do
|
49
|
-
[
|
50
|
-
{
|
51
|
-
master_project_id: 'master_project_id'
|
52
|
-
}
|
53
|
-
]
|
54
|
-
end
|
55
|
-
let(:params) do
|
56
|
-
params = {
|
57
|
-
gdc_gd_client: gdc_gd_client,
|
58
|
-
synchronize: [{}],
|
59
|
-
segments: [segment],
|
60
|
-
domain: domain,
|
61
|
-
ads_client: ads_client
|
62
|
-
}
|
63
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
64
|
-
end
|
65
|
-
|
66
|
-
before do
|
67
|
-
allow(client).to receive(:project).and_return(project)
|
68
|
-
allow(client).to receive(:project?).and_return(true)
|
69
|
-
allow(gdc_gd_client).to receive(:projects).with('master_project_id').and_return(project)
|
70
|
-
allow(client).to receive(:client_id).and_return('client_id')
|
71
|
-
allow(segment).to receive(:segment_id).and_return('segment-id')
|
72
|
-
allow(ads_client).to receive(:execute_select).and_return(ads_response)
|
73
|
-
allow(project).to receive(:pid)
|
74
|
-
allow(project).to receive(:title)
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'uses the project from client in segments' do
|
78
|
-
expect(client).to receive(:project)
|
79
|
-
subject.class.call(params)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/collect_tagged_objects'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
shared_examples 'a tagged object collector' do
|
11
|
-
it 'collects tagged objects' do
|
12
|
-
result = subject.class.call(params)
|
13
|
-
expected = {
|
14
|
-
results: [{ project: 'some_development_project_id',
|
15
|
-
transfer_uri: 'tagged1' },
|
16
|
-
{ project: 'some_development_project_id',
|
17
|
-
transfer_uri: 'tagged2' }],
|
18
|
-
params: {
|
19
|
-
synchronize: [{
|
20
|
-
from: 'some_development_project_id',
|
21
|
-
transfer_uris: tagged_objects
|
22
|
-
}]
|
23
|
-
}
|
24
|
-
}
|
25
|
-
expect(result).to eq(expected)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'finds projects by the specified tags' do
|
29
|
-
expect(development_project).to receive(:find_by_tag)
|
30
|
-
.with(['production_tag'])
|
31
|
-
subject.class.call(params)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe GoodData::LCM2::CollectTaggedObjects do
|
36
|
-
let(:development_client) { double('development_client') }
|
37
|
-
|
38
|
-
context 'when no production tags configured' do
|
39
|
-
let(:params) do
|
40
|
-
params = {
|
41
|
-
development_client: development_client,
|
42
|
-
synchronize: [{}],
|
43
|
-
segments: [{}]
|
44
|
-
}
|
45
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
46
|
-
end
|
47
|
-
|
48
|
-
before do
|
49
|
-
allow(development_client).to receive(:projects).and_return({})
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns an empty array' do
|
53
|
-
result = subject.class.call(params)
|
54
|
-
expect(result).to be_empty
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context 'when global production tags configured' do
|
59
|
-
let(:tagged_objects) { %w(tagged1 tagged2) }
|
60
|
-
let(:development_project) { double('development_project') }
|
61
|
-
|
62
|
-
before do
|
63
|
-
allow(development_project).to receive(:find_by_tag)
|
64
|
-
.and_return(tagged_objects)
|
65
|
-
allow(development_client).to receive(:projects)
|
66
|
-
.and_return(development_project)
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when segment-specific production tags specified' do
|
70
|
-
let(:params) do
|
71
|
-
params = {
|
72
|
-
development_client: development_client,
|
73
|
-
synchronize: [{ from: 'some_development_project_id' }],
|
74
|
-
segments: [{ production_tags: 'production_tag' }, {}]
|
75
|
-
}
|
76
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
77
|
-
end
|
78
|
-
|
79
|
-
it_behaves_like 'a tagged object collector'
|
80
|
-
end
|
81
|
-
|
82
|
-
context 'when global production tags specified' do
|
83
|
-
let(:params) do
|
84
|
-
params = {
|
85
|
-
development_client: development_client,
|
86
|
-
synchronize: [{ from: 'some_development_project_id' }],
|
87
|
-
segments: [{}],
|
88
|
-
production_tags: 'production_tag'
|
89
|
-
}
|
90
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
91
|
-
end
|
92
|
-
|
93
|
-
it_behaves_like 'a tagged object collector'
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when both global and segment-specific production tags specified' do
|
97
|
-
let(:params) do
|
98
|
-
params = {
|
99
|
-
development_client: development_client,
|
100
|
-
synchronize: [{ from: 'some_development_project_id' }],
|
101
|
-
segments: [{ production_tags: 'production_tag' }, {}],
|
102
|
-
production_tags: 'global_production_tag'
|
103
|
-
}
|
104
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
105
|
-
end
|
106
|
-
|
107
|
-
it_behaves_like 'a tagged object collector'
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'when using multi tags' do
|
111
|
-
let(:params) do
|
112
|
-
params = {
|
113
|
-
development_client: development_client,
|
114
|
-
synchronize: [{ from: 'some_development_project_id' }],
|
115
|
-
segments: [{ production_tags: %w(production_tag prod_tag2) }, {}]
|
116
|
-
}
|
117
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'finds projects by the specified tags' do
|
121
|
-
expect(development_project).to receive(:find_by_tag).with(%w(production_tag prod_tag2))
|
122
|
-
subject.class.call(params)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
describe GoodData::LCM2::CollectUsersBrickUsers do
|
8
|
-
let(:data_source) { double('data_source') }
|
9
|
-
let(:users_csv) do
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:params) do
|
13
|
-
params = {
|
14
|
-
users_brick_config: {
|
15
|
-
input_source: {},
|
16
|
-
login_column: 'Email'
|
17
|
-
}
|
18
|
-
}
|
19
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
20
|
-
end
|
21
|
-
|
22
|
-
before do
|
23
|
-
allow(GoodData::Helpers::DataSource).to receive(:new)
|
24
|
-
.and_return(data_source)
|
25
|
-
allow(data_source).to receive(:realize)
|
26
|
-
.and_return('spec/data/users.csv')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'enriches parameters with logins' do
|
30
|
-
result = subject.class.call(params)
|
31
|
-
expect(result[:results].length).to eq(11)
|
32
|
-
result[:results].each do |user|
|
33
|
-
expect(user[:login]).not_to be_nil
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/collect_segment_clients'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
describe GoodData::LCM2::CreateSegmentMasters do
|
11
|
-
let(:gdc_gd_client) { double('gdc_gd_client') }
|
12
|
-
let(:ads_client) { double('ads_client') }
|
13
|
-
let(:development_client) { double('development_client') }
|
14
|
-
let(:gdc_logger) { double('gdc_logger') }
|
15
|
-
let(:project) { double('project') }
|
16
|
-
let(:domain) { double('domain') }
|
17
|
-
let(:segment) { double('segment') }
|
18
|
-
let(:segments) { [segment] }
|
19
|
-
let(:data_product) { double('data_product') }
|
20
|
-
|
21
|
-
context 'when parametrizing project environment' do
|
22
|
-
let(:params) do
|
23
|
-
params = {
|
24
|
-
gdc_gd_client: gdc_gd_client,
|
25
|
-
synchronize: [{}],
|
26
|
-
segments: [{ segment_id: 'segment_foo', driver: 'Pg', master_name: 'name' }],
|
27
|
-
tokens: { pg: 'pgtoken' },
|
28
|
-
ads_client: ads_client,
|
29
|
-
domain: domain,
|
30
|
-
development_client: development_client,
|
31
|
-
gdc_logger: gdc_logger,
|
32
|
-
project_environment: 'DEVELOPMENT',
|
33
|
-
data_product: data_product
|
34
|
-
}
|
35
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
36
|
-
end
|
37
|
-
|
38
|
-
before do
|
39
|
-
allow(ads_client).to receive(:execute_select) { [{ version: '1.2' }] }
|
40
|
-
allow(development_client).to receive(:projects) { true }
|
41
|
-
allow(gdc_logger).to receive(:info) {}
|
42
|
-
allow(gdc_gd_client).to receive(:create_project) { project }
|
43
|
-
allow(gdc_gd_client).to receive(:domain) { domain }
|
44
|
-
allow(project).to receive(:pid) { '123' }
|
45
|
-
allow(project).to receive(:json) { {} }
|
46
|
-
allow(domain).to receive(:segments) { [] }
|
47
|
-
allow(domain).to receive(:create_segment) {}
|
48
|
-
allow(segment).to receive(:master_project) {}
|
49
|
-
allow(segment).to receive(:master_project=) {}
|
50
|
-
allow(segment).to receive(:save) {}
|
51
|
-
allow(segment).to receive(:synchronize_clients) {}
|
52
|
-
allow(data_product).to receive(:create_segment) { segment }
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'passes the argument to create_project' do
|
56
|
-
expect(gdc_gd_client).to receive(:create_project).with(
|
57
|
-
title: 'name',
|
58
|
-
auth_token: 'pgtoken',
|
59
|
-
driver: 'Pg',
|
60
|
-
environment: 'DEVELOPMENT'
|
61
|
-
)
|
62
|
-
subject.class.call(params)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/ensure_data_product'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
describe GoodData::LCM2::EnsureDataProduct do
|
11
|
-
context 'when data_product parameter is passed' do
|
12
|
-
let(:client) { double(:client) }
|
13
|
-
let(:domain) { double(:domain) }
|
14
|
-
let(:data_product) { GoodData::DataProduct.new({}) }
|
15
|
-
let(:gdc_logger) { double(:gdc_logger) }
|
16
|
-
|
17
|
-
let(:params) do
|
18
|
-
params = {
|
19
|
-
data_product: "data-product-#{SecureRandom.uuid}",
|
20
|
-
gdc_gd_client: client,
|
21
|
-
domain: domain,
|
22
|
-
gdc_logger: gdc_logger
|
23
|
-
}
|
24
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
25
|
-
end
|
26
|
-
|
27
|
-
before do
|
28
|
-
allow(domain).to receive(:data_products) { raise RestClient::BadRequest }
|
29
|
-
allow(domain).to receive(:create_data_product) { data_product }
|
30
|
-
allow(client).to receive(:domain) { domain }
|
31
|
-
allow(gdc_logger).to receive(:info) {}
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'creates the data_product' do
|
35
|
-
expect(domain).to receive(:create_data_product)
|
36
|
-
subject.class.call(params)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
-
# This source code is licensed under the BSD-style license found in the
|
5
|
-
# LICENSE file in the root directory of this source tree.
|
6
|
-
|
7
|
-
require 'gooddata/lcm/actions/ensure_technical_users_project'
|
8
|
-
require 'gooddata/lcm/lcm2'
|
9
|
-
|
10
|
-
shared_examples 'a technical users domain action' do
|
11
|
-
it 'adds technical user to the domain' do
|
12
|
-
expect(domain).to receive(:add_user)
|
13
|
-
.with(login: 'foo@bar.com', email: 'foo@bar.com')
|
14
|
-
subject.class.call(params)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe GoodData::LCM2::EnsureTechnicalUsersDomain do
|
19
|
-
let(:gdc_gd_client) { double(:gdc_gd_client) }
|
20
|
-
let(:domain) { double(:domain) }
|
21
|
-
let(:user) { double(:user) }
|
22
|
-
before do
|
23
|
-
allow(gdc_gd_client).to receive(:domain) { domain }
|
24
|
-
allow(domain).to receive(:users) { [] }
|
25
|
-
allow(user).to receive(:login)
|
26
|
-
allow(user).to receive(:email)
|
27
|
-
allow(domain).to receive(:add_user) { user }
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'when deprecated param technical_user specified' do
|
31
|
-
let(:params) do
|
32
|
-
params = {
|
33
|
-
gdc_gd_client: gdc_gd_client,
|
34
|
-
domain: domain,
|
35
|
-
technical_user: ['foo@bar.com']
|
36
|
-
}
|
37
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
38
|
-
end
|
39
|
-
it_behaves_like 'a technical users domain action'
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'when param technical_users specified' do
|
43
|
-
let(:params) do
|
44
|
-
params = {
|
45
|
-
gdc_gd_client: gdc_gd_client,
|
46
|
-
domain: domain,
|
47
|
-
technical_users: ['foo@bar.com']
|
48
|
-
}
|
49
|
-
GoodData::LCM2.convert_to_smart_hash(params)
|
50
|
-
end
|
51
|
-
it_behaves_like 'a technical users domain action'
|
52
|
-
end
|
53
|
-
end
|