gooddata 0.6.18 → 0.6.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.travis.yml +8 -19
- data/Guardfile +5 -0
- data/README.md +1 -3
- data/bin/gooddata +1 -1
- data/gooddata.gemspec +6 -4
- data/lib/gooddata.rb +1 -1
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +24 -0
- data/lib/gooddata/cli/commands/console_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/project_cmd.rb +29 -9
- data/lib/gooddata/cli/hooks.rb +9 -3
- data/lib/gooddata/commands/datawarehouse.rb +1 -7
- data/lib/gooddata/commands/project.rb +4 -3
- data/lib/gooddata/core/logging.rb +14 -2
- data/lib/gooddata/exceptions/execution_limit_exceeded.rb +9 -0
- data/lib/gooddata/exceptions/uncomputable_report.rb +8 -0
- data/lib/gooddata/exceptions/validation_error.rb +1 -1
- data/lib/gooddata/goodzilla/goodzilla.rb +5 -1
- data/lib/gooddata/helpers/data_helper.rb +40 -9
- data/lib/gooddata/mixins/md_finders.rb +35 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +46 -0
- data/lib/gooddata/models/blueprint/attribute_field.rb +25 -0
- data/lib/gooddata/models/blueprint/blueprint.rb +7 -0
- data/lib/gooddata/models/blueprint/blueprint_field.rb +66 -0
- data/lib/gooddata/models/{dashboard_builder.rb → blueprint/dashboard_builder.rb} +0 -0
- data/lib/gooddata/models/{schema_blueprint.rb → blueprint/dataset_blueprint.rb} +176 -117
- data/lib/gooddata/models/blueprint/date_dimension.rb +10 -0
- data/lib/gooddata/models/blueprint/fact_field.rb +16 -0
- data/lib/gooddata/models/blueprint/label_field.rb +39 -0
- data/lib/gooddata/models/{project_blueprint.rb → blueprint/project_blueprint.rb} +366 -168
- data/lib/gooddata/models/blueprint/project_builder.rb +79 -0
- data/lib/gooddata/models/blueprint/reference_field.rb +39 -0
- data/lib/gooddata/models/blueprint/schema_blueprint.rb +156 -0
- data/lib/gooddata/models/blueprint/schema_builder.rb +85 -0
- data/lib/gooddata/models/{to_manifest.rb → blueprint/to_manifest.rb} +25 -20
- data/lib/gooddata/models/{to_wire.rb → blueprint/to_wire.rb} +33 -52
- data/lib/gooddata/models/datawarehouse.rb +2 -2
- data/lib/gooddata/models/domain.rb +3 -2
- data/lib/gooddata/models/execution.rb +2 -2
- data/lib/gooddata/models/execution_detail.rb +7 -2
- data/lib/gooddata/models/from_wire.rb +60 -71
- data/lib/gooddata/models/from_wire_parse.rb +125 -125
- data/lib/gooddata/models/metadata.rb +14 -0
- data/lib/gooddata/models/metadata/dashboard.rb +2 -2
- data/lib/gooddata/models/metadata/label.rb +1 -1
- data/lib/gooddata/models/metadata/report.rb +6 -5
- data/lib/gooddata/models/metadata/report_definition.rb +44 -59
- data/lib/gooddata/models/model.rb +131 -43
- data/lib/gooddata/models/process.rb +13 -11
- data/lib/gooddata/models/profile.rb +12 -1
- data/lib/gooddata/models/project.rb +223 -19
- data/lib/gooddata/models/project_creator.rb +4 -15
- data/lib/gooddata/models/schedule.rb +1 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +2 -2
- data/lib/gooddata/rest/client.rb +18 -18
- data/lib/gooddata/rest/connection.rb +113 -94
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/project/model/model.rb.erb +15 -16
- data/spec/data/blueprints/additional_dataset_module.json +32 -0
- data/spec/data/blueprints/big_blueprint_not_pruned.json +2079 -0
- data/spec/data/blueprints/invalid_blueprint.json +103 -0
- data/spec/data/blueprints/m_n_model.json +104 -0
- data/spec/data/blueprints/model_module.json +25 -0
- data/spec/data/blueprints/test_blueprint.json +38 -0
- data/spec/data/blueprints/test_project_model_spec.json +106 -0
- data/spec/data/gd_gse_data_manifest.json +34 -34
- data/spec/data/manifests/test_blueprint.json +32 -0
- data/spec/data/{manifest_test_project.json → manifests/test_project.json} +9 -18
- data/spec/data/wire_models/test_blueprint.json +63 -0
- data/spec/data/wire_test_project.json +5 -5
- data/spec/environment/default.rb +33 -0
- data/spec/environment/develop.rb +26 -0
- data/spec/environment/environment.rb +14 -0
- data/spec/environment/hotfix.rb +17 -0
- data/spec/environment/production.rb +31 -0
- data/spec/environment/release.rb +17 -0
- data/spec/helpers/blueprint_helper.rb +10 -7
- data/spec/helpers/cli_helper.rb +24 -22
- data/spec/helpers/connection_helper.rb +27 -25
- data/spec/helpers/crypto_helper.rb +7 -5
- data/spec/helpers/csv_helper.rb +5 -3
- data/spec/helpers/process_helper.rb +15 -10
- data/spec/helpers/project_helper.rb +40 -33
- data/spec/helpers/schedule_helper.rb +15 -9
- data/spec/helpers/spec_helper.rb +11 -0
- data/spec/integration/blueprint_updates_spec.rb +93 -0
- data/spec/integration/command_datawarehouse_spec.rb +2 -1
- data/spec/integration/command_projects_spec.rb +9 -8
- data/spec/integration/create_from_template_spec.rb +1 -1
- data/spec/integration/create_project_spec.rb +1 -1
- data/spec/integration/full_process_schedule_spec.rb +1 -1
- data/spec/integration/full_project_spec.rb +91 -30
- data/spec/integration/over_to_user_filters_spec.rb +24 -28
- data/spec/integration/partial_md_export_import_spec.rb +4 -4
- data/spec/integration/project_spec.rb +1 -1
- data/spec/integration/rest_spec.rb +1 -1
- data/spec/integration/user_filters_spec.rb +19 -24
- data/spec/integration/variables_spec.rb +7 -9
- data/spec/logging_in_logging_out_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -1
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +47 -0
- data/spec/unit/core/connection_spec.rb +2 -2
- data/spec/unit/core/logging_spec.rb +12 -4
- data/spec/unit/helpers/data_helper_spec.rb +60 -0
- data/spec/unit/models/blueprint/attributes_spec.rb +24 -0
- data/spec/unit/models/blueprint/dataset_spec.rb +116 -0
- data/spec/unit/models/blueprint/labels_spec.rb +39 -0
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +643 -0
- data/spec/unit/models/blueprint/reference_spec.rb +24 -0
- data/spec/unit/models/{schema_builder_spec.rb → blueprint/schema_builder_spec.rb} +12 -4
- data/spec/unit/models/blueprint/to_wire_spec.rb +169 -0
- data/spec/unit/models/domain_spec.rb +13 -2
- data/spec/unit/models/from_wire_spec.rb +277 -98
- data/spec/unit/models/metadata_spec.rb +22 -4
- data/spec/unit/models/model_spec.rb +49 -39
- data/spec/unit/models/profile_spec.rb +1 -0
- data/spec/unit/models/project_spec.rb +7 -7
- data/spec/unit/models/schedule_spec.rb +20 -0
- data/spec/unit/models/to_manifest_spec.rb +31 -11
- data/spec/unit/rest/polling_spec.rb +86 -0
- metadata +102 -30
- data/lib/gooddata/models/project_builder.rb +0 -136
- data/lib/gooddata/models/schema_builder.rb +0 -77
- data/out.txt +0 -0
- data/spec/data/additional_dataset_module.json +0 -18
- data/spec/data/blueprint_invalid.json +0 -38
- data/spec/data/m_n_model/blueprint.json +0 -76
- data/spec/data/model_module.json +0 -18
- data/spec/data/test_project_model_spec.json +0 -76
- data/spec/unit/models/attribute_column_spec.rb +0 -7
- data/spec/unit/models/project_blueprint_spec.rb +0 -239
- data/spec/unit/models/to_wire_spec.rb +0 -71
@@ -10,7 +10,7 @@ RAW_DATA = {
|
|
10
10
|
'meta' =>
|
11
11
|
{'author'=>'/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
12
12
|
'uri'=>'/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/70',
|
13
|
-
'tags'=>'a b cg r t',
|
13
|
+
'tags'=>'a a b cg r t',
|
14
14
|
'created'=>'2014-04-30 22:47:57',
|
15
15
|
'identifier'=>'afo7bx1VakCz',
|
16
16
|
'deprecated'=>'0',
|
@@ -24,7 +24,7 @@ RAW_DATA = {
|
|
24
24
|
|
25
25
|
describe GoodData::MdObject do
|
26
26
|
before(:each) do
|
27
|
-
@instance = GoodData::MdObject.new(RAW_DATA)
|
27
|
+
@instance = GoodData::MdObject.new(RAW_DATA.deep_dup)
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '#identifier=' do
|
@@ -33,8 +33,26 @@ describe GoodData::MdObject do
|
|
33
33
|
@instance.identifier = 'new_id'
|
34
34
|
new_identifier = @instance.identifier
|
35
35
|
|
36
|
-
new_identifier.
|
37
|
-
new_identifier.
|
36
|
+
expect(new_identifier).to_not eq identifier
|
37
|
+
expect(new_identifier).to eq 'new_id'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#tag_list' do
|
42
|
+
it 'returns tags as list' do
|
43
|
+
expect(@instance.tag_set).to eq %w(a b cg r t).to_set
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#add_tag' do
|
48
|
+
it 'adds tag' do
|
49
|
+
expect(@instance.add_tag('xx').tag_set).to eq %w(a b cg r t xx).to_set
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#remove_tag' do
|
54
|
+
it 'returns tags as list' do
|
55
|
+
expect(@instance.remove_tag('t').tag_set).to eq %w(a b cg r).to_set
|
38
56
|
end
|
39
57
|
end
|
40
58
|
end
|
@@ -6,63 +6,73 @@ require 'gooddata/models/model'
|
|
6
6
|
describe GoodData::Model do
|
7
7
|
|
8
8
|
before(:each) do
|
9
|
-
@base_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/test_project_model_spec.json")
|
10
|
-
@additional_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/model_module.json")
|
9
|
+
@base_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/blueprints/test_project_model_spec.json")
|
10
|
+
@additional_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/blueprints/model_module.json")
|
11
11
|
|
12
12
|
@blueprint_with_duplicate = GoodData::Model::ProjectBlueprint.new(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
{
|
14
|
+
title: "x",
|
15
|
+
datasets: [{
|
16
|
+
id: "dataset.commits",
|
17
|
+
type: :dataset,
|
18
|
+
columns: [
|
19
|
+
{
|
20
|
+
type: "fact",
|
21
|
+
id: "fact.lines_changed",
|
22
|
+
gd_data_type: 'INT',
|
23
|
+
description: "Fact description"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}]
|
27
|
+
})
|
23
28
|
|
24
29
|
@conflicting_blueprint = GoodData::Model::ProjectBlueprint.new(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
{
|
31
|
+
title: 'x',
|
32
|
+
datasets: [{
|
33
|
+
type: :dataset,
|
34
|
+
id: 'dataset.commits',
|
35
|
+
columns: [
|
36
|
+
{
|
37
|
+
type: 'fact',
|
38
|
+
id: 'fact.commits.lines_changed'
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}]
|
42
|
+
})
|
35
43
|
end
|
36
44
|
|
37
45
|
it "should be possible to merge Schema blueprints" do
|
38
|
-
|
39
|
-
|
46
|
+
|
47
|
+
first_dataset = @base_blueprint.find_dataset("dataset.devs").to_hash
|
48
|
+
additional_blueprint = @additional_blueprint.find_dataset("dataset.devs").to_hash
|
40
49
|
stuff = GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint)
|
41
|
-
|
42
|
-
|
50
|
+
expect(GoodData::Model::ProjectBlueprint.new(stuff)).to be_valid
|
51
|
+
|
52
|
+
expect(stuff[:columns].include?({:type => :attribute, :id => "attr.region"})).to be_truthy
|
53
|
+
expect(stuff[:columns].include?({:type => :anchor, :id => "attr.devs.dev_id", title: 'Dev', :folder=>"Anchor folder" })).to be_truthy
|
43
54
|
end
|
44
55
|
|
45
56
|
it "should pass when merging 2 columns with the same name if both columns are identical" do
|
46
|
-
first_dataset = @base_blueprint.find_dataset("commits").to_hash
|
47
|
-
additional_blueprint = @blueprint_with_duplicate.find_dataset("commits").to_hash
|
48
|
-
|
57
|
+
first_dataset = @base_blueprint.find_dataset("dataset.commits").to_hash
|
58
|
+
additional_blueprint = @blueprint_with_duplicate.find_dataset("dataset.commits").to_hash
|
49
59
|
stuff = GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint)
|
60
|
+
|
61
|
+
expect(GoodData::Model::ProjectBlueprint.new(stuff)).to be_valid
|
50
62
|
|
51
|
-
stuff[:columns].count.
|
52
|
-
stuff[:columns].include?({:
|
53
|
-
stuff[:columns].group_by { |col| col[:
|
63
|
+
expect(stuff[:columns].count).to eq 6
|
64
|
+
expect(stuff[:columns].include?({ type: :fact, id: "fact.lines_changed", gd_data_type: 'INT', description: "Fact description"})).to be_truthy
|
65
|
+
expect(stuff[:columns].group_by { |col| col[:id] }["fact.lines_changed"].count).to eq 1
|
54
66
|
end
|
55
67
|
|
56
|
-
it "should
|
57
|
-
first_dataset = @base_blueprint.find_dataset("commits").to_hash
|
58
|
-
additional_blueprint = @conflicting_blueprint.find_dataset("commits").to_hash
|
59
|
-
|
68
|
+
it "should fail when merging" do
|
69
|
+
first_dataset = @base_blueprint.find_dataset("dataset.commits").to_hash
|
70
|
+
additional_blueprint = @conflicting_blueprint.find_dataset("dataset.commits").to_hash
|
60
71
|
expect { GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint) }.to raise_error
|
61
72
|
end
|
62
73
|
|
63
74
|
it "should be possible to merge directly whole bleuprints. Blueprint is changed in place when merge! is used" do
|
64
75
|
@base_blueprint.merge!(@additional_blueprint)
|
65
|
-
@base_blueprint.find_dataset("repos").attributes.include?({:
|
76
|
+
@base_blueprint.find_dataset("dataset.repos").attributes.include?({ type: "attribute", id: "some_attr_id", :title=>"Repository Name" })
|
66
77
|
end
|
67
|
-
|
68
|
-
end
|
78
|
+
end
|
@@ -75,7 +75,7 @@ describe GoodData::Project, :constraint => 'slow' do
|
|
75
75
|
|
76
76
|
describe "#member" do
|
77
77
|
it 'Returns GoodData::Membership when looking for existing user using login' do
|
78
|
-
res = @project.get_user(
|
78
|
+
res = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
|
79
79
|
expect(res).to be_instance_of(GoodData::Membership)
|
80
80
|
end
|
81
81
|
|
@@ -91,14 +91,14 @@ describe GoodData::Project, :constraint => 'slow' do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'Returns null for non-existing user' do
|
94
|
-
res = @project.get_user(
|
94
|
+
res = @project.get_user(ConnectionHelper::TEST_USERNAME)
|
95
95
|
expect(res).to be_nil
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
describe "#member?" do
|
100
100
|
it 'Returns true when looking for existing user using login' do
|
101
|
-
res = @project.member?(
|
101
|
+
res = @project.member?(ConnectionHelper::DEFAULT_USERNAME)
|
102
102
|
expect(res).to be_truthy
|
103
103
|
end
|
104
104
|
|
@@ -114,19 +114,19 @@ describe GoodData::Project, :constraint => 'slow' do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'Returns false for non-existing user' do
|
117
|
-
res = @project.member?(
|
117
|
+
res = @project.member?(ConnectionHelper::TEST_USERNAME)
|
118
118
|
expect(res).to be_falsey
|
119
119
|
end
|
120
120
|
|
121
121
|
it 'Returns true for existing user when using optional list' do
|
122
122
|
list = @project.members
|
123
|
-
res = @project.member?(
|
123
|
+
res = @project.member?(ConnectionHelper::DEFAULT_USERNAME, list)
|
124
124
|
expect(res).to be_truthy
|
125
125
|
end
|
126
126
|
|
127
127
|
it 'Returns false for non-existing user when using optional list' do
|
128
128
|
list = []
|
129
|
-
res = @project.member?(
|
129
|
+
res = @project.member?(ConnectionHelper::DEFAULT_USERNAME, list)
|
130
130
|
expect(res).to be_falsey
|
131
131
|
end
|
132
132
|
end
|
@@ -140,7 +140,7 @@ describe GoodData::Project, :constraint => 'slow' do
|
|
140
140
|
|
141
141
|
it 'Support variety of inputs' do
|
142
142
|
users = @project.members.take(1)
|
143
|
-
res = @project.members?(users + [
|
143
|
+
res = @project.members?(users + [ConnectionHelper::TEST_USERNAME])
|
144
144
|
expect(res).to eq [true, false]
|
145
145
|
end
|
146
146
|
end
|
@@ -496,4 +496,24 @@ describe GoodData::Schedule do
|
|
496
496
|
end
|
497
497
|
end
|
498
498
|
end
|
499
|
+
|
500
|
+
describe '#name' do
|
501
|
+
it 'should be able to get name of the schedule.' do
|
502
|
+
begin
|
503
|
+
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param)
|
504
|
+
expect(schedule.name).to eq 'graph.grf'
|
505
|
+
ensure
|
506
|
+
schedule && schedule.delete
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
it 'should be able to return your name if specified during creation.' do
|
511
|
+
begin
|
512
|
+
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, @project_executable, @test_data_with_optional_param.merge(name: 'My schedule name'))
|
513
|
+
expect(schedule.name).to eq 'My schedule name'
|
514
|
+
ensure
|
515
|
+
schedule && schedule.delete
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
499
519
|
end
|
@@ -5,20 +5,40 @@ include GoodData::Model
|
|
5
5
|
|
6
6
|
describe GoodData::Model::ToManifest do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
before(:each) do
|
9
|
+
@spec = JSON.parse(File.read("./spec/data/blueprints/test_project_model_spec.json"), :symbolize_names => true)
|
10
|
+
@result = JSON.parse(File.read("./spec/data/manifests/test_project.json"))
|
11
|
+
end
|
12
12
|
|
13
13
|
it "should parse the model view and return the blueprint" do
|
14
|
-
|
15
|
-
result = JSON.parse(File.read("./spec/data/manifest_test_project.json"))
|
16
|
-
expect(ToManifest.to_manifest(spec)).to eq result
|
14
|
+
expect(ToManifest.to_manifest(@spec)).to eq @result
|
17
15
|
end
|
18
16
|
|
19
|
-
it
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
it 'blueprint can be set with date reference and default format is set' do
|
18
|
+
skip('not yet')
|
19
|
+
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
20
|
+
p.add_date_dimension("committed_on")
|
21
|
+
|
22
|
+
p.add_dataset("repos") do |d|
|
23
|
+
d.add_anchor("repo_id")
|
24
|
+
d.add_attribute("name")
|
25
|
+
d.add_date('opportunity_comitted', dataset: 'committed_on')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'][2]['constraints']).to eq ({ "date" => GoodData::Model::DEFAULT_DATE_FORMAT })
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'blueprint can be set with date reference and default format is set' do
|
32
|
+
skip('not yet')
|
33
|
+
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
34
|
+
p.add_date_dimension("committed_on")
|
35
|
+
|
36
|
+
p.add_dataset("repos") do |d|
|
37
|
+
d.add_anchor("repo_id")
|
38
|
+
d.add_attribute("name")
|
39
|
+
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'][2]['constraints']).to eq ({ "date" => "yyyy/MM/dd" })
|
23
43
|
end
|
24
44
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'gooddata/rest/rest'
|
4
|
+
|
5
|
+
describe 'Behavior during polling and retries' do
|
6
|
+
before :each do
|
7
|
+
WebMock.enable!
|
8
|
+
|
9
|
+
@server = GoodData::Environment::ConnectionHelper::DEFAULT_SERVER
|
10
|
+
|
11
|
+
@coef = GoodData::Rest::Connection::RETRY_TIME_COEFFICIENT
|
12
|
+
@init = GoodData::Rest::Connection::RETRY_TIME_INITIAL_VALUE
|
13
|
+
@poll = GoodData::Rest::Client::DEFAULT_SLEEP_INTERVAL
|
14
|
+
|
15
|
+
GoodData::Rest::Connection.send(:remove_const, :RETRY_TIME_COEFFICIENT) if GoodData::Rest::Connection.const_defined?(:RETRY_TIME_COEFFICIENT)
|
16
|
+
GoodData::Rest::Connection.send(:remove_const, :RETRY_TIME_INITIAL_VALUE) if GoodData::Rest::Connection.const_defined?(:RETRY_TIME_INITIAL_VALUE)
|
17
|
+
GoodData::Rest::Client.send(:remove_const, :DEFAULT_SLEEP_INTERVAL) if GoodData::Rest::Client.const_defined?(:DEFAULT_SLEEP_INTERVAL)
|
18
|
+
|
19
|
+
GoodData::Rest::Connection.const_set(:RETRY_TIME_COEFFICIENT, 1)
|
20
|
+
GoodData::Rest::Connection.const_set(:RETRY_TIME_INITIAL_VALUE, 0)
|
21
|
+
GoodData::Rest::Client.const_set(:DEFAULT_SLEEP_INTERVAL, 0)
|
22
|
+
|
23
|
+
stub_request(:post, "#{@server}/gdc/account/login")
|
24
|
+
.to_return(:body => { :userLogin => { :profile => "/profile/123" }}.to_json, :headers => { 'Content-Type' => "application/json" })
|
25
|
+
stub_request(:get, "#{@server}/gdc/account/token")
|
26
|
+
.to_return(:body => {}.to_json, :headers => { 'Content-Type' => "application/json" })
|
27
|
+
stub_request(:get, "#{@server}/profile/123")
|
28
|
+
.to_return(:body => {}.to_json, :headers => { 'Content-Type' => "application/json" })
|
29
|
+
stub_request(:get, "#{@server}/poll_test")
|
30
|
+
.to_return(:body => {stuff: :aaa}.to_json, :headers => { 'Content-Type' => "application/json"} )
|
31
|
+
stub_request(:get, "#{@server}/too_many_reqs")
|
32
|
+
.to_return(:body => {}.to_json, :status => 429, :headers => { 'Content-Type' => "application/json"} )
|
33
|
+
stub_request(:get, "#{@server}/out_of_service")
|
34
|
+
.to_return(:body => {}.to_json, :status => 503, :headers => { 'Content-Type' => "application/json"} )
|
35
|
+
stub_request(:get, "#{@server}/internal_error")
|
36
|
+
.to_return(:body => {}.to_json, :status => 500, :headers => { 'Content-Type' => "application/json"} )
|
37
|
+
|
38
|
+
@client = GoodData.connect('aaa', 'bbbb')
|
39
|
+
GoodData.logging_on
|
40
|
+
end
|
41
|
+
|
42
|
+
after :each do
|
43
|
+
WebMock.disable!
|
44
|
+
GoodData::Rest::Connection.send(:remove_const, :RETRY_TIME_COEFFICIENT) if GoodData::Rest::Connection.const_defined?(:RETRY_TIME_COEFFICIENT)
|
45
|
+
GoodData::Rest::Connection.send(:remove_const, :RETRY_TIME_INITIAL_VALUE) if GoodData::Rest::Connection.const_defined?(:RETRY_TIME_INITIAL_VALUE)
|
46
|
+
GoodData::Rest::Client.send(:remove_const, :DEFAULT_SLEEP_INTERVAL) if GoodData::Rest::Client.const_defined?(:DEFAULT_SLEEP_INTERVAL)
|
47
|
+
|
48
|
+
GoodData::Rest::Connection.const_set(:RETRY_TIME_COEFFICIENT, @coef)
|
49
|
+
GoodData::Rest::Connection.const_set(:RETRY_TIME_INITIAL_VALUE, @init)
|
50
|
+
GoodData::Rest::Client.const_set(:DEFAULT_SLEEP_INTERVAL, @poll)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should fail a poller after timelimit passes' do
|
54
|
+
expect do
|
55
|
+
@client.poll_on_response('/poll_test', time_limit: 0.1) { |_| true }
|
56
|
+
end.to raise_error(GoodData::ExecutionLimitExceeded)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should make MAX_REQUESTS when hitting 429' do
|
60
|
+
expect do
|
61
|
+
@client.get('/too_many_reqs')
|
62
|
+
end.to raise_error(RestClient::TooManyRequests)
|
63
|
+
expect(a_request(:get, "#{@server}/too_many_reqs")).to have_been_made.times(10)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should make MAX_REQUESTS when hitting 503' do
|
67
|
+
expect do
|
68
|
+
@client.get('/out_of_service')
|
69
|
+
end.to raise_error(RestClient::ServiceUnavailable)
|
70
|
+
expect(a_request(:get, "#{@server}/out_of_service")).to have_been_made.times(10)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should make 1 additional request when hitting 500' do
|
74
|
+
expect do
|
75
|
+
@client.get('/internal_error')
|
76
|
+
end.to raise_error(RestClient::InternalServerError)
|
77
|
+
expect(a_request(:get, "#{@server}/internal_error")).to have_been_made.times(3)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'Number of requests can be overriden' do
|
81
|
+
expect do
|
82
|
+
@client.get('/internal_error', :tries => 4)
|
83
|
+
end.to raise_error(RestClient::InternalServerError)
|
84
|
+
expect(a_request(:get, "#{@server}/internal_error")).to have_been_made.times(4)
|
85
|
+
end
|
86
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gooddata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kolesnikov
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-07-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -99,20 +99,20 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 0.32.1
|
103
103
|
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
105
|
+
version: 0.32.1
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: 0.32.1
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
115
|
+
version: 0.32.1
|
116
116
|
- !ruby/object:Gem::Dependency
|
117
117
|
name: simplecov
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,6 +201,48 @@ dependencies:
|
|
201
201
|
- - ">="
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: 0.7.0
|
204
|
+
- !ruby/object:Gem::Dependency
|
205
|
+
name: guard
|
206
|
+
requirement: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - "~>"
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '2'
|
211
|
+
type: :development
|
212
|
+
prerelease: false
|
213
|
+
version_requirements: !ruby/object:Gem::Requirement
|
214
|
+
requirements:
|
215
|
+
- - "~>"
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '2'
|
218
|
+
- !ruby/object:Gem::Dependency
|
219
|
+
name: guard-rspec
|
220
|
+
requirement: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - "~>"
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '4'
|
225
|
+
type: :development
|
226
|
+
prerelease: false
|
227
|
+
version_requirements: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - "~>"
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '4'
|
232
|
+
- !ruby/object:Gem::Dependency
|
233
|
+
name: webmock
|
234
|
+
requirement: !ruby/object:Gem::Requirement
|
235
|
+
requirements:
|
236
|
+
- - "~>"
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: 1.21.0
|
239
|
+
type: :development
|
240
|
+
prerelease: false
|
241
|
+
version_requirements: !ruby/object:Gem::Requirement
|
242
|
+
requirements:
|
243
|
+
- - "~>"
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: 1.21.0
|
204
246
|
- !ruby/object:Gem::Dependency
|
205
247
|
name: debase
|
206
248
|
requirement: !ruby/object:Gem::Requirement
|
@@ -489,7 +531,7 @@ dependencies:
|
|
489
531
|
requirements:
|
490
532
|
- - "~>"
|
491
533
|
- !ruby/object:Gem::Version
|
492
|
-
version:
|
534
|
+
version: 1.7.2
|
493
535
|
- - ">="
|
494
536
|
- !ruby/object:Gem::Version
|
495
537
|
version: 1.7.2
|
@@ -499,7 +541,7 @@ dependencies:
|
|
499
541
|
requirements:
|
500
542
|
- - "~>"
|
501
543
|
- !ruby/object:Gem::Version
|
502
|
-
version:
|
544
|
+
version: 1.7.2
|
503
545
|
- - ">="
|
504
546
|
- !ruby/object:Gem::Version
|
505
547
|
version: 1.7.2
|
@@ -529,20 +571,20 @@ dependencies:
|
|
529
571
|
requirements:
|
530
572
|
- - "~>"
|
531
573
|
- !ruby/object:Gem::Version
|
532
|
-
version: '1.
|
574
|
+
version: '1.5'
|
533
575
|
- - ">="
|
534
576
|
- !ruby/object:Gem::Version
|
535
|
-
version: 1.
|
577
|
+
version: 1.5.1
|
536
578
|
type: :runtime
|
537
579
|
prerelease: false
|
538
580
|
version_requirements: !ruby/object:Gem::Requirement
|
539
581
|
requirements:
|
540
582
|
- - "~>"
|
541
583
|
- !ruby/object:Gem::Version
|
542
|
-
version: '1.
|
584
|
+
version: '1.5'
|
543
585
|
- - ">="
|
544
586
|
- !ruby/object:Gem::Version
|
545
|
-
version: 1.
|
587
|
+
version: 1.5.1
|
546
588
|
- !ruby/object:Gem::Dependency
|
547
589
|
name: salesforce_bulk_query
|
548
590
|
requirement: !ruby/object:Gem::Requirement
|
@@ -591,6 +633,7 @@ files:
|
|
591
633
|
- CHANGELOG.md
|
592
634
|
- CLI.md
|
593
635
|
- Gemfile
|
636
|
+
- Guardfile
|
594
637
|
- LICENSE
|
595
638
|
- README.md
|
596
639
|
- Rakefile
|
@@ -605,6 +648,7 @@ files:
|
|
605
648
|
- lib/gooddata/bricks/base_downloader.rb
|
606
649
|
- lib/gooddata/bricks/brick.rb
|
607
650
|
- lib/gooddata/bricks/bricks.rb
|
651
|
+
- lib/gooddata/bricks/middleware/aws_middleware.rb
|
608
652
|
- lib/gooddata/bricks/middleware/base_middleware.rb
|
609
653
|
- lib/gooddata/bricks/middleware/bench_middleware.rb
|
610
654
|
- lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
|
@@ -661,8 +705,10 @@ files:
|
|
661
705
|
- lib/gooddata/exceptions/attr_element_not_found.rb
|
662
706
|
- lib/gooddata/exceptions/command_failed.rb
|
663
707
|
- lib/gooddata/exceptions/exceptions.rb
|
708
|
+
- lib/gooddata/exceptions/execution_limit_exceeded.rb
|
664
709
|
- lib/gooddata/exceptions/no_project_error.rb
|
665
710
|
- lib/gooddata/exceptions/project_not_found.rb
|
711
|
+
- lib/gooddata/exceptions/uncomputable_report.rb
|
666
712
|
- lib/gooddata/exceptions/user_in_different_domain.rb
|
667
713
|
- lib/gooddata/exceptions/validation_error.rb
|
668
714
|
- lib/gooddata/extensions/big_decimal.rb
|
@@ -714,7 +760,22 @@ files:
|
|
714
760
|
- lib/gooddata/mixins/root_key_getter.rb
|
715
761
|
- lib/gooddata/mixins/root_key_setter.rb
|
716
762
|
- lib/gooddata/mixins/timestamps.rb
|
717
|
-
- lib/gooddata/models/
|
763
|
+
- lib/gooddata/models/blueprint/anchor_field.rb
|
764
|
+
- lib/gooddata/models/blueprint/attribute_field.rb
|
765
|
+
- lib/gooddata/models/blueprint/blueprint.rb
|
766
|
+
- lib/gooddata/models/blueprint/blueprint_field.rb
|
767
|
+
- lib/gooddata/models/blueprint/dashboard_builder.rb
|
768
|
+
- lib/gooddata/models/blueprint/dataset_blueprint.rb
|
769
|
+
- lib/gooddata/models/blueprint/date_dimension.rb
|
770
|
+
- lib/gooddata/models/blueprint/fact_field.rb
|
771
|
+
- lib/gooddata/models/blueprint/label_field.rb
|
772
|
+
- lib/gooddata/models/blueprint/project_blueprint.rb
|
773
|
+
- lib/gooddata/models/blueprint/project_builder.rb
|
774
|
+
- lib/gooddata/models/blueprint/reference_field.rb
|
775
|
+
- lib/gooddata/models/blueprint/schema_blueprint.rb
|
776
|
+
- lib/gooddata/models/blueprint/schema_builder.rb
|
777
|
+
- lib/gooddata/models/blueprint/to_manifest.rb
|
778
|
+
- lib/gooddata/models/blueprint/to_wire.rb
|
718
779
|
- lib/gooddata/models/data_result.rb
|
719
780
|
- lib/gooddata/models/datawarehouse.rb
|
720
781
|
- lib/gooddata/models/domain.rb
|
@@ -744,18 +805,12 @@ files:
|
|
744
805
|
- lib/gooddata/models/process.rb
|
745
806
|
- lib/gooddata/models/profile.rb
|
746
807
|
- lib/gooddata/models/project.rb
|
747
|
-
- lib/gooddata/models/project_blueprint.rb
|
748
|
-
- lib/gooddata/models/project_builder.rb
|
749
808
|
- lib/gooddata/models/project_creator.rb
|
750
809
|
- lib/gooddata/models/project_metadata.rb
|
751
810
|
- lib/gooddata/models/project_role.rb
|
752
811
|
- lib/gooddata/models/report_data_result.rb
|
753
812
|
- lib/gooddata/models/schedule.rb
|
754
|
-
- lib/gooddata/models/schema_blueprint.rb
|
755
|
-
- lib/gooddata/models/schema_builder.rb
|
756
813
|
- lib/gooddata/models/tab_builder.rb
|
757
|
-
- lib/gooddata/models/to_manifest.rb
|
758
|
-
- lib/gooddata/models/to_wire.rb
|
759
814
|
- lib/gooddata/models/user_filters/mandatory_user_filter.rb
|
760
815
|
- lib/gooddata/models/user_filters/user_filter.rb
|
761
816
|
- lib/gooddata/models/user_filters/user_filter_builder.rb
|
@@ -777,12 +832,16 @@ files:
|
|
777
832
|
- lib/templates/project/data/devs.csv
|
778
833
|
- lib/templates/project/data/repos.csv
|
779
834
|
- lib/templates/project/model/model.rb.erb
|
780
|
-
- out.txt
|
781
835
|
- spec/bricks/bricks_spec.rb
|
782
836
|
- spec/bricks/default-config.json
|
783
837
|
- spec/data/.gooddata
|
784
|
-
- spec/data/additional_dataset_module.json
|
785
|
-
- spec/data/
|
838
|
+
- spec/data/blueprints/additional_dataset_module.json
|
839
|
+
- spec/data/blueprints/big_blueprint_not_pruned.json
|
840
|
+
- spec/data/blueprints/invalid_blueprint.json
|
841
|
+
- spec/data/blueprints/m_n_model.json
|
842
|
+
- spec/data/blueprints/model_module.json
|
843
|
+
- spec/data/blueprints/test_blueprint.json
|
844
|
+
- spec/data/blueprints/test_project_model_spec.json
|
786
845
|
- spec/data/cc/data/source/commits.csv
|
787
846
|
- spec/data/cc/data/source/devs.csv
|
788
847
|
- spec/data/cc/data/source/repos.csv
|
@@ -799,20 +858,25 @@ files:
|
|
799
858
|
- spec/data/hello_world_process/hello_world.rb
|
800
859
|
- spec/data/hello_world_process/hello_world.zip
|
801
860
|
- spec/data/line_based_permissions.csv
|
802
|
-
- spec/data/
|
803
|
-
- spec/data/
|
804
|
-
- spec/data/model_module.json
|
861
|
+
- spec/data/manifests/test_blueprint.json
|
862
|
+
- spec/data/manifests/test_project.json
|
805
863
|
- spec/data/ruby_params_process/ruby_params.rb
|
806
864
|
- spec/data/ruby_process/deep_files/deep_stuff.txt
|
807
865
|
- spec/data/ruby_process/process.rb
|
808
866
|
- spec/data/ruby_process/stuff.txt
|
809
867
|
- spec/data/superfluous_titles_view.json
|
810
868
|
- spec/data/test-ci-data.csv
|
811
|
-
- spec/data/test_project_model_spec.json
|
812
869
|
- spec/data/users.csv
|
813
870
|
- spec/data/wire_models/model_view.json
|
814
871
|
- spec/data/wire_models/nu_model.json
|
872
|
+
- spec/data/wire_models/test_blueprint.json
|
815
873
|
- spec/data/wire_test_project.json
|
874
|
+
- spec/environment/default.rb
|
875
|
+
- spec/environment/develop.rb
|
876
|
+
- spec/environment/environment.rb
|
877
|
+
- spec/environment/hotfix.rb
|
878
|
+
- spec/environment/production.rb
|
879
|
+
- spec/environment/release.rb
|
816
880
|
- spec/helpers/blueprint_helper.rb
|
817
881
|
- spec/helpers/cli_helper.rb
|
818
882
|
- spec/helpers/connection_helper.rb
|
@@ -821,6 +885,8 @@ files:
|
|
821
885
|
- spec/helpers/process_helper.rb
|
822
886
|
- spec/helpers/project_helper.rb
|
823
887
|
- spec/helpers/schedule_helper.rb
|
888
|
+
- spec/helpers/spec_helper.rb
|
889
|
+
- spec/integration/blueprint_updates_spec.rb
|
824
890
|
- spec/integration/command_datawarehouse_spec.rb
|
825
891
|
- spec/integration/command_projects_spec.rb
|
826
892
|
- spec/integration/create_from_template_spec.rb
|
@@ -836,6 +902,7 @@ files:
|
|
836
902
|
- spec/logging_in_logging_out_spec.rb
|
837
903
|
- spec/spec_helper.rb
|
838
904
|
- spec/unit/bricks/bricks_spec.rb
|
905
|
+
- spec/unit/bricks/middleware/aws_middelware_spec.rb
|
839
906
|
- spec/unit/bricks/middleware/bench_middleware_spec.rb
|
840
907
|
- spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb
|
841
908
|
- spec/unit/bricks/middleware/gooddata_middleware_spec.rb
|
@@ -868,9 +935,16 @@ files:
|
|
868
935
|
- spec/unit/extensions/hash_spec.rb
|
869
936
|
- spec/unit/godzilla/goodzilla_spec.rb
|
870
937
|
- spec/unit/helpers/csv_helper_spec.rb
|
938
|
+
- spec/unit/helpers/data_helper_spec.rb
|
871
939
|
- spec/unit/helpers/global_helpers_spec.rb
|
872
940
|
- spec/unit/helpers_spec.rb
|
873
|
-
- spec/unit/models/
|
941
|
+
- spec/unit/models/blueprint/attributes_spec.rb
|
942
|
+
- spec/unit/models/blueprint/dataset_spec.rb
|
943
|
+
- spec/unit/models/blueprint/labels_spec.rb
|
944
|
+
- spec/unit/models/blueprint/project_blueprint_spec.rb
|
945
|
+
- spec/unit/models/blueprint/reference_spec.rb
|
946
|
+
- spec/unit/models/blueprint/schema_builder_spec.rb
|
947
|
+
- spec/unit/models/blueprint/to_wire_spec.rb
|
874
948
|
- spec/unit/models/domain_spec.rb
|
875
949
|
- spec/unit/models/execution_spec.rb
|
876
950
|
- spec/unit/models/from_wire_spec.rb
|
@@ -881,17 +955,15 @@ files:
|
|
881
955
|
- spec/unit/models/model_spec.rb
|
882
956
|
- spec/unit/models/params_spec.rb
|
883
957
|
- spec/unit/models/profile_spec.rb
|
884
|
-
- spec/unit/models/project_blueprint_spec.rb
|
885
958
|
- spec/unit/models/project_creator.rb
|
886
959
|
- spec/unit/models/project_role_spec.rb
|
887
960
|
- spec/unit/models/project_spec.rb
|
888
961
|
- spec/unit/models/schedule_spec.rb
|
889
|
-
- spec/unit/models/schema_builder_spec.rb
|
890
962
|
- spec/unit/models/to_manifest_spec.rb
|
891
|
-
- spec/unit/models/to_wire_spec.rb
|
892
963
|
- spec/unit/models/unit_project.rb
|
893
964
|
- spec/unit/models/user_filters_spec.rb
|
894
965
|
- spec/unit/models/variable_spec.rb
|
966
|
+
- spec/unit/rest/polling_spec.rb
|
895
967
|
- spec/unit/rest/resource_spec.rb
|
896
968
|
- tmp/.gitkeepme
|
897
969
|
- yard-server.sh
|