hybrid_platforms_conductor 33.9.4 → 33.9.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
2
  SHA256:
3
- metadata.gz: 433e01481e26d03667cde79b93697f0f14e949a6201931c6e570ebb84670e79a
4
- data.tar.gz: 61c1eb5c9b9ec3df221528e8ae1c08a7a6bdf3628c2a6a83b1756e11a84a2e88
3
+ metadata.gz: 03d8f9c77d6fd058348749c2ba567f905af52558207e281c8d20678775bfc85c
4
+ data.tar.gz: 56ca17b26a52bee7cff5659718a283368270815e5e61f1bc4cae0201da1d39c8
5
5
  SHA512:
6
- metadata.gz: 31ff562ab7108537b8ba57b8c657ef516ef5665fb40fc81d4afe4f14a54400f62324597136845af8c39bd8788318d3d12c54362562cb73dff9d769c60cf8bce1
7
- data.tar.gz: cb7dfea944204a89f9522703fb588ec8085dcd9a92816abe0cc012f0e7440432ee4a3831825517ae9b74f59e1ac1ff7d4995b6fa75220c28096de1a8e95f31b6
6
+ metadata.gz: 6a97cab5245e2b0bcf27a869b783055560b3f0f95a70b3596fdba74fd64f4ddc41af715c54e66561ea59afdde83f382a5ff9e1fc05c9e85842276450e467cae9
7
+ data.tar.gz: 521ea609ddc3952fbb924fb333f40901ed28396b575899c5dae2a43256c2e821162de13bb94a2c846817816205d062960590cc3088f3d0f6da74821103a62519
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [v33.9.5](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.4...v33.9.5) (2022-03-20 17:46:29)
2
+
3
+ ### Patches
4
+
5
+ * [[#118] Fix linear strategy checks when merge commits are found](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/01464ae5bb5c39e95be6216fceed0e9ac00ae83e)
6
+
1
7
  # [v33.9.4](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.3...v33.9.4) (2022-03-20 16:20:04)
2
8
 
3
9
  ### Patches
@@ -20,18 +20,18 @@ module HybridPlatformsConductor
20
20
  _exit_status, stdout, _stderr = @cmd_runner.run_cmd(<<~EO_BASH, log_to_stdout: log_debug?, no_exception: true, expected_code: [0, 1])
21
21
  cd #{@platform.repository_path} && \
22
22
  git --no-pager log \
23
+ --pretty=format:\"%H\" \
24
+ --graph \
23
25
  $(git merge-base \
24
26
  --octopus \
25
27
  $(git --no-pager log #{merge_commit_id} --max-count 1 --pretty=format:\"%P\") \
26
- )..#{merge_commit_id} \
27
- --pretty=format:\"%H\" \
28
- --graph \
28
+ )..#{merge_commit_id}
29
29
  | grep '|'
30
30
  EO_BASH
31
31
  next if stdout.empty?
32
32
 
33
33
  _exit_status, stdout, _stderr = @cmd_runner.run_cmd(
34
- "cd #{@platform.repository_path} && git --no-pager log #{merge_commit_id} --max-count 1 --pretty=format:%aI",
34
+ "cd #{@platform.repository_path} && git show --no-patch --format=%ci #{merge_commit_id}",
35
35
  log_to_stdout: log_debug?
36
36
  )
37
37
  error "Git history is not linear because of Merge commit #{merge_commit_id}" if Time.now - Time.parse(stdout.strip) < LOOKING_PERIOD
@@ -1,5 +1,5 @@
1
1
  module HybridPlatformsConductor
2
2
 
3
- VERSION = '33.9.4'
3
+ VERSION = '33.9.5'
4
4
 
5
5
  end
@@ -0,0 +1,69 @@
1
+ describe HybridPlatformsConductor::TestsRunner do
2
+
3
+ context 'when checking test plugins' do
4
+
5
+ context 'with linear_strategy' do
6
+
7
+ it 'succeeds when git history is linear' do
8
+ with_test_platform({}) do |repository_path|
9
+ test_tests_runner.tests = [:linear_strategy]
10
+ with_cmd_runner_mocked [
11
+ ["cd #{repository_path} && git --no-pager log --merges --pretty=format:\"%H\"", proc { [0, '', ''] }]
12
+ ] do
13
+ expect(test_tests_runner.run_tests([])).to eq 0
14
+ end
15
+ end
16
+ end
17
+
18
+ it 'succeeds when git history is semi-linear' do
19
+ with_test_platform({}) do |repository_path|
20
+ test_tests_runner.tests = [:linear_strategy]
21
+ with_cmd_runner_mocked [
22
+ ["cd #{repository_path} && git --no-pager log --merges --pretty=format:\"%H\"", proc { [0, "11111111\n22222222\n", ''] }],
23
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 11111111 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.11111111\s+\| grep '\|'$/, proc { [1, '', ''] }],
24
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 22222222 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.22222222\s+\| grep '\|'$/, proc { [1, '', ''] }]
25
+ ] do
26
+ expect(test_tests_runner.run_tests([])).to eq 0
27
+ end
28
+ end
29
+ end
30
+
31
+ it 'fails when git history is not semi-linear' do
32
+ with_test_platform({}) do |repository_path|
33
+ test_tests_runner.tests = [:linear_strategy]
34
+ register_tests_report_plugins(test_tests_runner, report: HybridPlatformsConductorTest::TestsReportPlugin)
35
+ test_tests_runner.reports = [:report]
36
+ with_cmd_runner_mocked [
37
+ ["cd #{repository_path} && git --no-pager log --merges --pretty=format:\"%H\"", proc { [0, "11111111\n22222222\n", ''] }],
38
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 11111111 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.11111111\s+\| grep '\|'$/, proc { [1, '', ''] }],
39
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 22222222 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.22222222\s+\| grep '\|'$/, proc { [0, '* | 33333333', ''] }],
40
+ ["cd #{repository_path} && git show --no-patch --format=%ci 22222222", proc { [0, "#{(Time.now - (24 * 60 * 60)).strftime('%F %T')}\n", ''] }]
41
+ ] do
42
+ expect(test_tests_runner.run_tests([])).to eq 1
43
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.size).to eq 1
44
+ expect(HybridPlatformsConductorTest::TestsReportPlugin.reports.first[:platform_tests].sort).to eq [
45
+ [:linear_strategy, true, 'platform', ['Git history is not linear because of Merge commit 22222222']]
46
+ ]
47
+ end
48
+ end
49
+ end
50
+
51
+ it 'succeeds when git history is not semi-linear before 6 months' do
52
+ with_test_platform({}) do |repository_path|
53
+ test_tests_runner.tests = [:linear_strategy]
54
+ with_cmd_runner_mocked [
55
+ ["cd #{repository_path} && git --no-pager log --merges --pretty=format:\"%H\"", proc { [0, "11111111\n22222222\n", ''] }],
56
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 11111111 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.11111111\s+\| grep '\|'$/, proc { [1, '', ''] }],
57
+ [/^cd #{Regexp.escape(repository_path)} && git --no-pager log\s+--pretty=format:"%H"\s+--graph\s+\$\(git merge-base\s+--octopus\s+\$\(git --no-pager log 22222222 --max-count 1 --pretty=format:"%P"\)\s*\)\.\.22222222\s+\| grep '\|'$/, proc { [0, '* | 33333333', ''] }],
58
+ ["cd #{repository_path} && git show --no-patch --format=%ci 22222222", proc { [0, "#{(Time.now - (6 * 31 * 24 * 60 * 60)).strftime('%F %T')}\n", ''] }]
59
+ ] do
60
+ expect(test_tests_runner.run_tests([])).to eq 0
61
+ end
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+
69
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hybrid_platforms_conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 33.9.4
4
+ version: 33.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
@@ -950,6 +950,7 @@ files:
950
950
  - spec/hybrid_platforms_conductor_test/api/tests_runner/reports_spec.rb
951
951
  - spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb
952
952
  - spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb
953
+ - spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/linear_strategy_spec.rb
953
954
  - spec/hybrid_platforms_conductor_test/api/tests_runner/test_reports_plugins/confluence_spec.rb
954
955
  - spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb.rb
955
956
  - spec/hybrid_platforms_conductor_test/cmdb_plugins/test_cmdb_2.rb