File: test.rake

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (115 lines) | stat: -rw-r--r-- 3,661 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
require "rake/testtask"

Rake::TestTask.new do |t|
  t.description = "Run integration and unit tests"
  t.libs << "test"
  t.pattern = File.join("test", "**", "test_*.rb")
  t.warning = false
end

namespace :test do
  mock = ENV["FOG_MOCK"] || "true"
  task :travis do
    sh("bundle exec rake test:unit")
  end

  desc "Run all integration tests in parallel"
  multitask :parallel => ["test:compute",
                          "test:monitoring",
                          "test:pubsub",
                          "test:sql",
                          "test:storage"]

  Rake::TestTask.new do |t|
    t.name = "unit"
    t.description = "Run Unit tests"
    t.libs << "test"
    t.pattern = FileList["test/unit/**/test_*.rb"]
    t.warning = false
    t.verbose = true
  end

  # This autogenerates rake tasks based on test folder structures
  # This is done to simplify running many test suites in parallel
  COMPUTE_TEST_TASKS = []
  Dir.glob("test/integration/compute/**").each do |task|
    suite_collection = task.gsub(/test\/integration\/compute\//, "")
    component_name = task.gsub(/test\/integration\//, "").split("/").first
    Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
      t.libs << "test"
      t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
      t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
      t.warning = false
      t.verbose = true
    end
    COMPUTE_TEST_TASKS << "#{component_name}-#{suite_collection}"
  end

  desc "Run Compute API tests"
  task :compute => COMPUTE_TEST_TASKS

  desc "Run Compute API tests in parallel"
  multitask :compute_parallel => COMPUTE_TEST_TASKS

  Rake::TestTask.new do |t|
    t.name = "monitoring"
    t.description = "Run Monitoring API tests"
    t.libs << "test"
    t.pattern = FileList["test/integration/monitoring/test_*.rb"]
    t.warning = false
    t.verbose = true
  end

  Rake::TestTask.new do |t|
    t.name = "pubsub"
    t.description = "Run PubSub API tests"
    t.libs << "test"
    t.pattern = FileList["test/integration/pubsub/test_*.rb"]
    t.warning = false
    t.verbose = true
  end

  # This autogenerates rake tasks based on test folder structures
  # This is done to simplify running many test suites in parallel
  SQL_TEST_TASKS = []
  Dir.glob("test/integration/sql/**").each do |task|
    suite_collection = task.gsub(/test\/integration\/sql\//, "")
    component_name = task.gsub(/test\/integration\//, "").split("/").first
    Rake::TestTask.new(:"#{component_name}-#{suite_collection}") do |t|
      t.libs << "test"
      t.description = "Autotask - run #{component_name} integration tests - #{suite_collection}"
      t.pattern = FileList["test/integration/#{component_name}/#{suite_collection}/test_*.rb"]
      t.warning = false
      t.verbose = true
    end
    SQL_TEST_TASKS << "#{component_name}-#{suite_collection}"
  end

  desc "Run SQL API tests"
  task :sql => SQL_TEST_TASKS

  desc "Run SQL API tests in parallel"
  multitask :sql_parallel => SQL_TEST_TASKS

  # TODO(temikus): Remove after v1 is renamed in pipeline
  desc "Run SQL API tests - v1 compat alias"
  task :"sql-sqlv2" => :sql

  Rake::TestTask.new do |t|
    t.name = "sql"
    t.description = "Run SQL API tests"
    t.libs << "test"
    t.pattern = FileList["test/integration/sql/test_*.rb"]
    t.warning = false
    t.verbose = true
  end

  Rake::TestTask.new do |t|
    t.name = "storage"
    t.description = "Run Storage API tests"
    t.libs << "test"
    t.pattern = FileList["test/integration/storage/test_*.rb"]
    t.warning = false
    t.verbose = true
  end
end