testrailtagging 0.3.8.4 → 0.3.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: af7c34382755322b02544cb166a43b304a37e6b5
4
- data.tar.gz: 3ff0363f332f5144430cd08cf9c9eba4be717c07
2
+ SHA256:
3
+ metadata.gz: f37a99cc06d1145c1895ae5f04757f10183a048e64e59dabdc1c8403d0f7212a
4
+ data.tar.gz: 721856049f244b684633b303985678ab1698740778a79a7e254d7cb1497742bb
5
5
  SHA512:
6
- metadata.gz: 64a8c220b778ab6e8f6c634a7bb893576d6fe4211c36207d5338a75f2b6094edb8885f937788a0bebae20bc32c61f828421458de60d6e3d6f95951538462d340
7
- data.tar.gz: f124e7cb3756f6779f50d2845302675a71c836ff9e2d3e0ee178481355218cd0a860380d79b75824a7c459c3545e7fe252a2e62f4f8e072152f54cf759b1711d
6
+ metadata.gz: 4abc90728c7a8c8f346e97a7a95d3bdfa3c205d5f943239e90845a51a00a9d0032dcef51886c1b386b7a46727b0f61de45de52d1b3baf3b2c14c159dd36a3555
7
+ data.tar.gz: f023c5d34851814a633419b8a8a66d3847cf85fa22006d595180ec486939d27f4f8f3e67ae24b5c3933d32d2415911c9a88f0b3b5028d46fee32d53a51318375
data/README.md CHANGED
@@ -32,6 +32,11 @@ Hence to do anything with this gem you will need to set the following environmen
32
32
  `TESTRAIL_PASSWORD`
33
33
 
34
34
  which this gem will look for and use.
35
+
36
+ `TESTRAIL_RUN_DELETE_DAYS`
37
+ `TESTRAIL_RUN_DELETE_FORCE`
38
+ With RUN_DELETE_DAYS defined the gem will delete all test runs in the provided plan_id that are older than
39
+ the days specified. There is a limit of 7 days which can be overridden with RUN_DELETE_FORCE set to true.
35
40
 
36
41
  ### For Reporting results to testrail
37
42
 
@@ -34,6 +34,8 @@ module TestRail
34
34
  puts "TestRail rate limited. retrying in #{exponential_backoff_seconds}"
35
35
  sleep exponential_backoff_seconds
36
36
  exponential_backoff_seconds *= 3
37
+ elsif e.message && e.message.match("Net::OpenTimeout")
38
+ sleep 1
37
39
  else
38
40
  # Don't retry it, let the exception propagate
39
41
  raise
@@ -1,5 +1,6 @@
1
1
  require_relative "testrail_apiclient_retry"
2
2
  require_relative "TestCase"
3
+ require "date"
3
4
 
4
5
  # =================================================================================
5
6
  #
@@ -302,6 +303,24 @@ module TestRailOperations
302
303
  trclient.send_post_retry(uri, "results" => data)
303
304
  end
304
305
 
306
+ # For a given test plan deletes all runs equal to or older than the days passed
307
+ # Note that testrail stores runs as an entry and requires the entry id to remove the run
308
+ # To delete closer than 7 days, pass in force_delete = true
309
+ def self.delete_plan_entry(plan_id, days, force_delete = false)
310
+ if days >= 7 || force_delete == true
311
+ clean_date = (Date.today - days).to_time.to_i
312
+ trclient = get_test_rail_client
313
+ request = "get_plan/#{plan_id}"
314
+ response = trclient.send_get(request)
315
+ response["entries"].each do |entry|
316
+ if entry["runs"][0]["created_on"] <= clean_date
317
+ uri = "delete_plan_entry/#{plan_id}/#{entry["id"]}"
318
+ trclient.send_post_retry(uri, "")
319
+ end
320
+ end
321
+ end
322
+ end
323
+
305
324
  # When a test run is created, the test cases have new, sort of temporary ID's.
306
325
  # These are completely different from the permanent static ID's of the test cases.
307
326
  # Given a test run ID, this gets the test cases that are assigned to that test run.
@@ -80,6 +80,12 @@ module TestRailRSpecIntegration
80
80
  @batch_size = 1
81
81
  end
82
82
 
83
+ # Initialize the number of cleanup days for test rail runs based on environment variable.
84
+ # Unless force_delete = true is passed the minimum is 7 days.
85
+ if !ENV["TESTRAIL_RUN_DELETE_DAYS"].nil? && !@testrail_plan_id.nil?
86
+ TestRailOperations.delete_plan_entry(@testrail_plan_id, ENV["TESTRAIL_RUN_DELETE_DAYS"].to_f, ENV["TESTRAIL_RUN_DELETE_FORCE"])
87
+ end
88
+
83
89
  # Pull down ALL the test cases from testrail. Granted this is more than what rspec will actually
84
90
  # execute. But there is no safe way to append a test case to a test run in a parallel environment.
85
91
  # The Testrail API is just too limited.
data/lib/files/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Testrailtagging
2
- VERSION = "0.3.8.4"
2
+ VERSION = "0.3.8.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrailtagging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8.4
4
+ version: 0.3.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Johnson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.5.2.3
128
+ rubygems_version: 2.7.4
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Utilities for working with testrail.
132
132
  test_files: []
133
- has_rdoc: