bellows 1.1.2 → 1.1.3

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * Sun Sep 23 2012 Dan Prince <dprince@redhat.com> - 1.1.3
2
+ - Add support for per project job types in the config file.
3
+
1
4
  * Sun July 29 2012 Dan Prince <dprince@redhat.com> - 1.1.2
2
5
  - Add --branch option to stream task.
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.1.3
@@ -35,13 +35,25 @@ module Bellows
35
35
  end
36
36
 
37
37
  DEFAULT_JOB_TYPES=[{'name' => 'job_unit_tester', 'auto_approved' => false, 'description' => 'Unit'}]
38
- def self.job_types()
38
+ def self.job_types(project=nil)
39
39
  configs=Util.load_configs
40
- job_type_list = configs['job_types']
40
+
41
+ job_type_list = nil
42
+
43
+ if not project.nil? and configs[project] then
44
+ if configs[project]['job_types']
45
+ job_type_list = configs[project]['job_types']
46
+ end
47
+ else
48
+ job_type_list = configs['job_types']
49
+ end
50
+
41
51
  if job_type_list.nil? or job_type_list.empty? then
42
52
  job_type_list = DEFAULT_JOB_TYPES
43
53
  end
54
+
44
55
  job_type_list
56
+
45
57
  end
46
58
 
47
59
  def self.smoke_tests(projects)
data/lib/bellows/tasks.rb CHANGED
@@ -152,7 +152,7 @@ module Bellows
152
152
  jobs_for_rev = Bellows::SmokeStack.jobs_with_hash(revision, jobs)
153
153
  if jobs_for_rev.count > 0 then
154
154
 
155
- job_types = Bellows::SmokeStack.job_types
155
+ job_types = Bellows::SmokeStack.job_types(project)
156
156
  job_datas = []
157
157
  job_types.each do |job_type|
158
158
  job_data=Bellows::SmokeStack.job_data_for_type(jobs_for_rev, job_type['name'])
data/lib/bellows/util.rb CHANGED
@@ -78,11 +78,19 @@ module Bellows
78
78
  config_template_ids = nil
79
79
  # per project configs may be specified in the config file
80
80
  if not project.nil? and configs[project] then
81
- test_suite_ids = configs[project]['test_suite_ids'].collect {|x| x.to_s }
82
- config_template_ids = configs[project]['config_template_ids'].collect {|x| x.to_s }
83
- else
84
- # if no configs specified use the configured defaults
81
+ if configs[project]['test_suite_ids'] then
82
+ test_suite_ids = configs[project]['test_suite_ids'].collect {|x| x.to_s }
83
+ end
84
+ if configs[project]['config_template_ids'] then
85
+ config_template_ids = configs[project]['config_template_ids'].collect {|x| x.to_s }
86
+ end
87
+ end
88
+
89
+ # if no configs specified use the configured defaults
90
+ if test_suite_ids.nil? then
85
91
  test_suite_ids = configs['test_suite_ids'].collect {|x| x.to_s }
92
+ end
93
+ if config_template_ids.nil? then
86
94
  config_template_ids = configs['config_template_ids'].collect {|x| x.to_s }
87
95
  end
88
96
  return test_suite_ids, config_template_ids
@@ -0,0 +1,32 @@
1
+ smokestack_url: http://localhost:3000
2
+ smokestack_username: admin
3
+ smokestack_password: cloud
4
+
5
+ config_template_ids:
6
+ - 1
7
+ - 2
8
+
9
+ test_suite_ids:
10
+ - 1
11
+
12
+ glance:
13
+ config_template_ids:
14
+ - 3
15
+ - 4
16
+
17
+ test_suite_ids:
18
+ - 2
19
+
20
+ nova:
21
+ job_types:
22
+ - name: job_unit_tester
23
+ auto_approved: true
24
+ description: "Unit"
25
+
26
+ - name: job_puppet_vpc
27
+ auto_approved: false
28
+ description: "Libvirt (Fedora 16)"
29
+
30
+ - name: job_chef_vpc_xen
31
+ auto_approved: false
32
+ description: "XenServer 5.6 SP2"
@@ -29,4 +29,28 @@ class SmokeStackTest < Test::Unit::TestCase
29
29
 
30
30
  end
31
31
 
32
+ def test_job_types_custom_project_config
33
+
34
+ sample_config = fixture('config_custom_project.yaml')
35
+ Bellows::Util.stubs(:load_configs).returns(YAML::load(sample_config))
36
+
37
+ # there should only be 1 set for the default (no project)
38
+ assert_equal 1, Bellows::SmokeStack.job_types.size
39
+
40
+ # there should only be 1 set for the glance project
41
+ assert_equal 1, Bellows::SmokeStack.job_types("glance").size
42
+
43
+ # the nova project should have custom job types defined
44
+ unit_tester_type = Bellows::SmokeStack.job_types("nova")[0]
45
+ assert_equal 'job_unit_tester', unit_tester_type['name']
46
+ assert_equal 'Unit', unit_tester_type['description']
47
+ assert_equal true, unit_tester_type['auto_approved']
48
+
49
+ unit_tester_type = Bellows::SmokeStack.job_types("nova")[1]
50
+ assert_equal 'job_puppet_vpc', unit_tester_type['name']
51
+ assert_equal 'Libvirt (Fedora 16)', unit_tester_type['description']
52
+ assert_equal false, unit_tester_type['auto_approved']
53
+
54
+ end
55
+
32
56
  end
data/test/test_util.rb CHANGED
@@ -7,4 +7,27 @@ class UtilTest < Test::Unit::TestCase
7
7
  assert_equal "123/123", Bellows::Util.short_spec("123/123/123")
8
8
  end
9
9
 
10
+ # test for Utils.test_configs
11
+ def test_test_configs
12
+ sample_config = fixture('config_custom_project.yaml')
13
+ Bellows::Util.stubs(:load_configs).returns(YAML::load(sample_config))
14
+
15
+ # ensure configs are set for a project which specifies them
16
+ test_suite_ids, config_template_ids = Bellows::Util.test_configs("glance")
17
+
18
+ assert_equal "3", config_template_ids[0]
19
+ assert_equal "4", config_template_ids[1]
20
+
21
+ assert_equal "2", test_suite_ids[0]
22
+
23
+ # ensure default configs are used for project that doesn't specify them
24
+ test_suite_ids, config_template_ids = Bellows::Util.test_configs("nova")
25
+
26
+ assert_equal "1", config_template_ids[0]
27
+ assert_equal "2", config_template_ids[1]
28
+
29
+ assert_equal "1", test_suite_ids[0]
30
+
31
+ end
32
+
10
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bellows
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-30 00:00:00.000000000 Z
12
+ date: 2012-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -149,6 +149,7 @@ files:
149
149
  - lib/bellows/tasks.rb
150
150
  - lib/bellows/util.rb
151
151
  - test/fixtures/config.yaml
152
+ - test/fixtures/config_custom_project.yaml
152
153
  - test/fixtures/gerrit.json
153
154
  - test/fixtures/jobs.json
154
155
  - test/fixtures/nova_smoke_tests.json
@@ -172,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  version: '0'
173
174
  segments:
174
175
  - 0
175
- hash: 4254685906647564606
176
+ hash: -4222018101242764028
176
177
  required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  none: false
178
179
  requirements: