ticket-replicator 1.0.0 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7606fa759b9d684b5f7ba6f51ae8492d0d75aa12f35aecf18dcacad00128d3ed
4
- data.tar.gz: 31c447e651e6f1a3ee29f99d3ff5d82716f17ea2f26c0bcf99e120f73164695f
3
+ metadata.gz: '018e90cb8cce2dd15fdb8b766ec815f875a502b2404da79d5c11265b12d00ff9'
4
+ data.tar.gz: 5746059539911a89e647a9ef0b0de23dd060476ebaa55d5d79543354786fb25c
5
5
  SHA512:
6
- metadata.gz: 83564cefebd76b731d4bf201bf85aa076f11ad69344d8d6bc81ff43677946bc7050318f57fea6528ecf222a203a815e28dd8120b5fd4d9a2feb610c8e00a0a66
7
- data.tar.gz: 9c7e90104e65a3ad37316714715c18ef83280b0d27feb272d73f110aeeda7d5cb47d22aaeff8a4c901ebd714115c9ae38078bdd9a1696c66eb46652466d1120b
6
+ metadata.gz: 2f25722b36fb72167dd32f6d2a13a3855a8f3eaec98aa40ba2ac65b643ee4b318671d5236029856ebb89acf343bd9fdfa2588ddf387e8b91a71ea432ab84cc00
7
+ data.tar.gz: d301a6fe343826713be40f74cddc41fcd51a3b005009c16990b87e5e708e7312385a0925ed349668583556d50b8be2d45319fe407de5cf1ba0ca7328fb44c5c5
data/.rubocop.yml CHANGED
@@ -16,6 +16,11 @@ Style/Documentation:
16
16
  Style/HashSyntax:
17
17
  Enabled: false
18
18
 
19
+ Style/SafeNavigation:
20
+ Enabled: true
21
+ AllowedMethods:
22
+ - '[]'
23
+
19
24
  Style/StringLiterals:
20
25
  EnforcedStyle: double_quotes
21
26
 
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.4.3
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # Ticket::Replicator
2
2
 
3
3
  [![Ruby](https://github.com/cbroult/ticket-replicator/actions/workflows/main.yml/badge.svg)](https://github.com/cbroult/ticket-replicator/actions/workflows/main.yml)
4
+ [![Dependabot Updates](https://github.com/cbroult/ticket-replicator/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/cbroult/ticket-replicator/actions/workflows/dependabot/dependabot-updates)
4
5
 
5
6
  ## Purpose
6
7
 
7
8
  In order to:
8
- * have an overall transparency about all the activities pertaining to a project/product,
9
- * track progress
10
- * act accordingly
9
+ * Have an overall transparency about all the activities pertaining to a project/product,
10
+ * Track progress
11
+ * Act accordingly
11
12
 
12
13
  As a stakeholder
13
14
 
@@ -20,17 +21,15 @@ I need to replicate defect information from one system to a single reference sys
20
21
  * ... and add to the application's Gemfile by executing:
21
22
 
22
23
  ```bash
23
- bundle add TODO: GEM_NAME
24
+ bundle add ticket-replicator
24
25
  ```
25
26
 
26
27
  * ... if bundler is not being used to manage dependencies, by executing:
27
28
 
28
29
  ```bash
29
- gem install TODO: GEM_NAME
30
+ gem install ticket-replicator
30
31
  ```
31
32
 
32
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
33
-
34
33
  ## Setup
35
34
 
36
35
  ### Set environment variables
@@ -38,6 +37,7 @@ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_O
38
37
  Define the following environment variables
39
38
  - `TICKET_REPLICATOR_JIRA_PROJECT_KEY`
40
39
  - `TICKET_REPLICATOR_JIRA_TICKET_TYPE_NAME`
40
+ - `TICKET_REPLICATOR_SOURCE_TICKET_URL_ERB`
41
41
 
42
42
  For your JIRA access the following variables have to be defined:
43
43
 
@@ -51,7 +51,7 @@ Optional environment variables:
51
51
  - `JIRA_HTTP_DEBUG` - Enable HTTP debug logging (set to "true" or "false").
52
52
  - `JAT_RATE_INTERVAL_IN_SECONDS` - Interval for rate limiting in seconds (e.g., "1").
53
53
  - `JAT_RATE_LIMIT_PER_INTERVAL` - Rate limit per interval for Jira API calls (e.g., "1")
54
-
54
+ - `TICKET_REPLICATOR_DISABLE_RESOLUTION_LOADING` - To deal with tickets not having a resolution field.
55
55
 
56
56
  ### Setup Queue Folder And Field Mapping
57
57
 
@@ -61,7 +61,7 @@ Optional environment variables:
61
61
  ```
62
62
  1. Edit the field mapping configuration file to fit your context.
63
63
 
64
- ### Target Jira Ticket Type Workflow Expectation - Any to Any
64
+ ### Jira Ticket Type Workflow Expectation - Any to Any
65
65
 
66
66
  The target issue type in Jira must have a workflow that allows direct transitions between any states. This avoids
67
67
  the need for administrative rights to calculate complex transition paths or discover workflow states through trial
@@ -4,12 +4,14 @@
4
4
  ### WARNING
5
5
  field_mapping:
6
6
  id: Defect
7
- summary: Defect (2)
7
+ summary: Defect
8
8
  priority: Defect Priority
9
9
  resolution: Defect Status
10
10
  status: Defect Status
11
11
  team: Defect Support Team (2)
12
12
 
13
+ id_extraction_regex: "\\((?<id>\\d+)\\)$"
14
+
13
15
  priority_mapping:
14
16
  "1: Critical": "Highest"
15
17
  "2: High": "High"
@@ -13,117 +13,130 @@ Feature: Load tickets into Jira
13
13
  Scenario: Load tickets in Jira
14
14
  Given a file named "queue/20.transformed/sap_solution_manager_defects.csv" with:
15
15
  """
16
- "ID","Status","Resolution","Priority","Summary"
17
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
18
- "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
19
- "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)"
20
- "10004","Closed","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)"
21
- "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)"
22
- "10006","Solution Proposal","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)"
23
- "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)"
24
- "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)"
25
- "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)"
16
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
17
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
18
+ "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
19
+ "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)","http://url/to/source/ticket/10003"
20
+ "10004","Closed","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)","http://url/to/source/ticket/10004"
21
+ "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)","http://url/to/source/ticket/10005"
22
+ "10006","Solution Proposal","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)","http://url/to/source/ticket/10006"
23
+ "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)","http://url/to/source/ticket/10007"
24
+ "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)","http://url/to/source/ticket/10008"
25
+ "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)","http://url/to/source/ticket/10009"
26
26
  """
27
27
  When I successfully run `ticket-replicator --load`
28
28
  Then the Jira project should only have the following tickets:
29
- | status | resolution | priority | summary | source ticket url |
30
- | Open | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | https://sap.example/id/10001 |
31
- | In Process | | Highest | SMAN-10002 \| Database deadlock during order processing (10002) | https://sap.example/id/10002 |
32
- | Confirmed | Done | Medium | SMAN-10003 \| Invalid date format in SOAP response (10003) | https://sap.example/id/10003 |
33
- | Closed | Done | Low | SMAN-10004 \| App crashes when offline on Android 12 (10004) | https://sap.example/id/10004 |
34
- | Open | | High | SMAN-10005 \| Session tokens not properly invalidated (10005) | https://sap.example/id/10005 |
35
- | Solution Proposal | | Medium | SMAN-10006 \| Jenkins pipeline timeout on large builds (10006) | https://sap.example/id/10006 |
36
- | Withdrawn | Won't Do | Low | SMAN-10007 \| Test data missing edge case scenarios (10007) | https://sap.example/id/10007 |
37
- | Open | | Highest | SMAN-10008 \| Memory leak in caching implementation (10008) | https://sap.example/id/10008 |
38
- | Wait on External | | Medium | SMAN-10009 \| Inconsistent button styles across modules (10009) | https://sap.example/id/10009 |
39
- And the source ticket URL is found in the ticket descriptions of those tickets
29
+ | status | resolution | priority | summary | source_ticket_url |
30
+ | Open | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | http://url/to/source/ticket/10001 |
31
+ | In Process | | Highest | SMAN-10002 \| Database deadlock during order processing (10002) | http://url/to/source/ticket/10002 |
32
+ | Confirmed | Done | Medium | SMAN-10003 \| Invalid date format in SOAP response (10003) | http://url/to/source/ticket/10003 |
33
+ | Closed | Done | Low | SMAN-10004 \| App crashes when offline on Android 12 (10004) | http://url/to/source/ticket/10004 |
34
+ | Open | | High | SMAN-10005 \| Session tokens not properly invalidated (10005) | http://url/to/source/ticket/10005 |
35
+ | Solution Proposal | | Medium | SMAN-10006 \| Jenkins pipeline timeout on large builds (10006) | http://url/to/source/ticket/10006 |
36
+ | Withdrawn | Won't Do | Low | SMAN-10007 \| Test data missing edge case scenarios (10007) | http://url/to/source/ticket/10007 |
37
+ | Open | | Highest | SMAN-10008 \| Memory leak in caching implementation (10008) | http://url/to/source/ticket/10008 |
38
+ | Wait on External | | Medium | SMAN-10009 \| Inconsistent button styles across modules (10009) | http://url/to/source/ticket/10009 |
39
+
40
+
41
+ Scenario: Load tickets in Jira w/o their resolution
42
+ Given the following environment variables have been set:
43
+ | name | value |
44
+ | TICKET_REPLICATOR_DISABLE_RESOLUTION_LOADING | true |
45
+ Given a file named "queue/20.transformed/sap_solution_manager_defects.csv" with:
46
+ """
47
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
48
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
49
+ "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)","http://url/to/source/ticket/10003"
50
+ "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)","http://url/to/source/ticket/10007"
51
+ """
52
+ When I successfully run `ticket-replicator --load`
53
+ Then the Jira project should only have the following tickets:
54
+ | status | resolution | priority | summary | source_ticket_url |
55
+ | Open | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | http://url/to/source/ticket/10001 |
56
+ | Confirmed | | Medium | SMAN-10003 \| Invalid date format in SOAP response (10003) | http://url/to/source/ticket/10003 |
57
+ | Withdrawn | | Low | SMAN-10007 \| Test data missing edge case scenarios (10007) | http://url/to/source/ticket/10007 |
58
+
40
59
 
41
60
  Scenario: Loading the ticket information twice in Jira does not create additional tickets
42
61
  Given a file named "queue/20.transformed/sap_solution_manager_defects.csv" with:
43
62
  """
44
- "ID","Status","Resolution","Priority","Summary"
45
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
46
- "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
63
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
64
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
65
+ "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
47
66
  """
48
67
  And a file named "queue/20.transformed/sap_solution_manager_defects.SAME_CONTENT.csv" with:
49
68
  """
50
- "ID","Status","Resolution","Priority","Summary"
51
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
52
- "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
69
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
70
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
71
+ "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
53
72
  """
54
73
  When I successfully run `ticket-replicator --load`
55
74
  Then the Jira project should only have the following tickets:
56
- | status | resolution | priority | summary | source ticket url |
57
- | Open | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | https://sap.example/id/10001 |
58
- | In Process | | Highest | SMAN-10002 \| Database deadlock during order processing (10002) | https://sap.example/id/10002 |
59
- And the source ticket URL is found in the ticket descriptions of those tickets
75
+ | status | resolution | priority | summary | source_ticket_url |
76
+ | Open | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | http://url/to/source/ticket/10001 |
77
+ | In Process | | Highest | SMAN-10002 \| Database deadlock during order processing (10002) | http://url/to/source/ticket/10002 |
60
78
 
61
79
  Scenario: Tickets are updated only if changes happened or they were not replicated before
62
80
  Given a file named "queue/20.transformed/2025-03-29.16h16.sap_solution_manager_defects.csv" with:
63
81
  """
64
- "ID","Status","Resolution","Priority","Summary"
65
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
66
- "10002","In Process","Cannot Reproduce","Medium","SMAN-10002 | Database deadlock during order processing (10002)"
67
- "10016","Confirmed","Done","High","SMAN-10016 | Slow response time on product search API (10016)"
82
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
83
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
84
+ "10002","In Process","Cannot Reproduce","Medium","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
85
+ "10016","Confirmed","Done","High","SMAN-10016 | Slow response time on product search API (10016)","http://url/to/source/ticket/10016"
68
86
  """
69
87
  And I successfully run `ticket-replicator --load`
70
88
  When a file named "queue/20.transformed/2025-03-29.19h56.update_tickets.csv" with:
71
89
  """
72
- "ID","Status","Resolution","Priority","Summary"
73
- "10001","Closed","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
74
- "10002","In Process","","High","SMAN-10002 | *Recurring* database deadlock during order processing (10002)"
75
- "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)"
76
- "10016","Confirmed","Done","High","SMAN-10016 | Slow response time on product search API (10016)"
90
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
91
+ "10001","Closed","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
92
+ "10002","In Process","","High","SMAN-10002 | *Recurring* database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
93
+ "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)","http://url/to/source/ticket/10008"
94
+ "10016","Confirmed","Done","High","SMAN-10016 | Slow response time on product search API (10016)","http://url/to/source/ticket/10016"
77
95
  """
78
96
  And I successfully run `ticket-replicator --jira-http-debug --load`
79
97
  Then the Jira project should only have the following tickets:
80
- | example purpose | status | resolution | priority | summary | source ticket url |
81
- | one update due to status change | Closed | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | https://sap.example/id/10001 |
82
- | one update due to priority, resolution and summary updates | In Process | | High | SMAN-10002 \| *Recurring* database deadlock during order processing (10002) | https://sap.example/id/10002 |
83
- | two updates due to new ticket created (fields and status changes) | Open | | Highest | SMAN-10008 \| Memory leak in caching implementation (10008) | https://sap.example/id/10008 |
84
- | no update since no status or field change | Confirmed | Done | High | SMAN-10016 \| Slow response time on product search API (10016) | https://sap.example/id/10016 |
85
- And only 4 Jira update requests were emitted
98
+ | example purpose | status | resolution | priority | summary | source_ticket_url |
99
+ | one update due to status change | Closed | | Highest | SMAN-10001 \| Login page randomly fails to load CSS assets (10001) | http://url/to/source/ticket/10001 |
100
+ | one update due to priority, resolution and summary updates | In Process | | High | SMAN-10002 \| *Recurring* database deadlock during order processing (10002) | http://url/to/source/ticket/10002 |
101
+ | three updates due to new ticket created (fields, source ticket link and status) | Open | | Highest | SMAN-10008 \| Memory leak in caching implementation (10008) | http://url/to/source/ticket/10008 |
102
+ | no update since no status or field change | Confirmed | Done | High | SMAN-10016 \| Slow response time on product search API (10016) | http://url/to/source/ticket/10016 |
103
+ And only 5 Jira update requests were emitted
86
104
 
87
105
  Scenario: Attempting to set an unexpected status generates information about the current row being loaded
88
106
  Given a file named "queue/20.transformed/sap_solution_manager_defects.csv" with:
89
107
  """
90
- "ID","Status","Resolution","Priority","Summary"
91
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
92
- "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
93
- "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)"
94
- "10004","____ INEXISTING STATUS ____","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)"
95
- "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)"
96
- "10006","Solution Proposal","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)"
97
- "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)"
98
- "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)"
99
- "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)"
108
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
109
+ "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
110
+ "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
111
+ "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)","http://url/to/source/ticket/10003"
112
+ "10004","____ INEXISTING STATUS ____","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)","http://url/to/source/ticket/10004"
113
+ "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)","http://url/to/source/ticket/10005"
114
+ "10006","Solution Proposal","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)","http://url/to/source/ticket/10006"
115
+ "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)","http://url/to/source/ticket/10007"
116
+ "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)","http://url/to/source/ticket/10008"
117
+ "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)","http://url/to/source/ticket/10009"
100
118
  """
101
119
  When I run `ticket-replicator --load`
102
120
  Then it should fail with:
103
121
  """
104
122
  ERROR Object : Ticket::Replicator::FileLoader::LoadError: queue/20.transformed/sap_solution_manager_defects.csv:5: error while loading row:
105
123
  No transition found for "____ INEXISTING STATUS ____" in ["No Error -> No Error", "Tester Action -> Tester Action", "Close Bug -> Closed", "Confirmed -> Confirmed", "Defect Correction in Process -> Defect Correction in Process", "Deferred -> Deferred", "Forwarded -> Forwarded", "Information Required -> Information Required", "New -> New", "Open -> Open", "Solution Proposal -> Solution Proposal", "Wait for Defect Correction -> Wait for Defect Correction", "Wait on External -> Wait on External", "Withdrawn -> Withdrawn", "In Process -> In Process"].:
106
- #<CSV::Row id:"10004" status:"____ INEXISTING STATUS ____" resolution:"Done" priority:"Low" summary:"SMAN-10004 | App crashes when offline on Android 12 (10004)">
124
+ #<CSV::Row id:"10004" status:"____ INEXISTING STATUS ____" resolution:"Done" priority:"Low" summary:"SMAN-10004 | App crashes when offline on Android 12 (10004)" source_ticket_url:"http://url/to/source/ticket/10004">
107
125
  """
108
126
 
109
127
  Scenario: Attempting to set an unexpected priority generates information about the current row being loaded
110
128
  Given a file named "queue/20.transformed/sap_solution_manager_defects.csv" with:
111
129
  """
112
- "ID","Status","Resolution","Priority","Summary"
113
- "10001","Open","","Highest","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
114
- "10002","In Process","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
115
- "10003","Confirmed","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)"
116
- "10004","Closed","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)"
117
- "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)"
118
- "10006","Solution Proposal","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)"
119
- "10007","Withdrawn","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)"
120
- "10008","Open","","____ UNEXPECTED PRIORITY ____","SMAN-10008 | Memory leak in caching implementation (10008)"
121
- "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)"
130
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
131
+ "10008","Open","","____ UNEXPECTED PRIORITY ____","SMAN-10008 | Memory leak in caching implementation (10008)","http://url/to/source/ticket/10008"
132
+ "10009","Wait on External","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)","http://url/to/source/ticket/10009"
122
133
  """
123
134
  When I run `ticket-replicator --load`
124
135
  Then it should fail with:
125
136
  """
126
- ERROR Object : Ticket::Replicator::FileLoader::LoadError: queue/20.transformed/sap_solution_manager_defects.csv:9: error while loading row:
137
+ ERROR Object : Ticket::Replicator::FileLoader::LoadError: queue/20.transformed/sap_solution_manager_defects.csv:2: error while loading row:
127
138
  Bad Request:
128
- #<CSV::Row id:"10008" status:"Open" resolution:"" priority:"____ UNEXPECTED PRIORITY ____" summary:"SMAN-10008 | Memory leak in caching implementation (10008)">
139
+ #<CSV::Row id:"10008" status:"Open" resolution:"" priority:"____ UNEXPECTED PRIORITY ____" summary:"SMAN-10008 | Memory leak in caching implementation (10008)" source_ticket_url:"http://url/to/source/ticket/10008">
129
140
  """
141
+
142
+
@@ -20,12 +20,14 @@ Feature: Setup Ticket Replicator
20
20
  ### WARNING
21
21
  field_mapping:
22
22
  id: Defect
23
- summary: Defect (2)
23
+ summary: Defect
24
24
  priority: Defect Priority
25
25
  resolution: Defect Status
26
26
  status: Defect Status
27
27
  team: Defect Support Team (2)
28
28
 
29
+ id_extraction_regex: "\\((?<id>\\d+)\\)$"
30
+
29
31
  priority_mapping:
30
32
  "1: Critical": "Highest"
31
33
  "2: High": "High"
@@ -5,13 +5,13 @@ Feature: Transform SAP tickets to Jira format
5
5
 
6
6
  Background:
7
7
  Given the following environment variables have been set:
8
- | name | value |
9
- | TICKET_REPLICATOR_SOURCE_TICKET_BASE_URL_ERB | http://url/to/source/ticket/<%= source_id %> |
10
-
8
+ | name | value |
9
+ | TICKET_REPLICATOR_SOURCE_TICKET_URL | http://url/to/source/ticket/<%= source_ticket_id %> |
11
10
 
12
11
  Scenario: Transform valid ticket CSV
13
12
  Given a file named "config/ticket-replicator.mappings.yml" with:
14
13
  """
14
+ ---
15
15
  field_mapping:
16
16
  id: ID
17
17
  summary: Summary
@@ -62,22 +62,23 @@ Feature: Transform SAP tickets to Jira format
62
62
  When I successfully run `ticket-replicator --transform`
63
63
  Then a file named "queue/20.transformed/sap_solution_manager_defects.csv" should contain exactly:
64
64
  """
65
- "ID","Status","Resolution","Priority","Summary"
66
- "10001","Open","","High","SMAN-10001 | Login page randomly fails to load CSS assets (10001)"
67
- "10002","In Progress","","Highest","SMAN-10002 | Database deadlock during order processing (10002)"
68
- "10003","Resolved","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)"
69
- "10004","Closed","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)"
70
- "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)"
71
- "10006","In Review","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)"
72
- "10007","Closed","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)"
73
- "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)"
74
- "10009","Blocked","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)"
75
- "10010","Resolved","Done","High","SMAN-10010 | Slow response time on product search API (10010)"
65
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
66
+ "10001","Open","","High","SMAN-10001 | Login page randomly fails to load CSS assets (10001)","http://url/to/source/ticket/10001"
67
+ "10002","In Progress","","Highest","SMAN-10002 | Database deadlock during order processing (10002)","http://url/to/source/ticket/10002"
68
+ "10003","Resolved","Done","Medium","SMAN-10003 | Invalid date format in SOAP response (10003)","http://url/to/source/ticket/10003"
69
+ "10004","Closed","Done","Low","SMAN-10004 | App crashes when offline on Android 12 (10004)","http://url/to/source/ticket/10004"
70
+ "10005","Open","","High","SMAN-10005 | Session tokens not properly invalidated (10005)","http://url/to/source/ticket/10005"
71
+ "10006","In Review","","Medium","SMAN-10006 | Jenkins pipeline timeout on large builds (10006)","http://url/to/source/ticket/10006"
72
+ "10007","Closed","Won't Do","Low","SMAN-10007 | Test data missing edge case scenarios (10007)","http://url/to/source/ticket/10007"
73
+ "10008","Open","","Highest","SMAN-10008 | Memory leak in caching implementation (10008)","http://url/to/source/ticket/10008"
74
+ "10009","Blocked","","Medium","SMAN-10009 | Inconsistent button styles across modules (10009)","http://url/to/source/ticket/10009"
75
+ "10010","Resolved","Done","High","SMAN-10010 | Slow response time on product search API (10010)","http://url/to/source/ticket/10010"
76
76
  """
77
77
 
78
78
  Scenario: Transform valid ticket Excel
79
79
  Given a file named "config/ticket-replicator.mappings.yml" with:
80
80
  """
81
+ ---
81
82
  field_mapping:
82
83
  id: Defect
83
84
  summary: Defect (2)
@@ -127,29 +128,80 @@ Feature: Transform SAP tickets to Jira format
127
128
  When I successfully run `ticket-replicator --transform`
128
129
  Then a file named "queue/20.transformed/sap_solution_manager_defects.csv" should contain exactly:
129
130
  """
130
- "ID","Status","Resolution","Priority","Summary"
131
- "3000017049","Closed","Done","Medium","SMAN-3000017049 | Summary"
132
- "9400011377","Confirmed","","Low","SMAN-9400011377 | Summary"
133
- "3000016618","Defect Correction in Process","","Medium","SMAN-3000016618 | Summary"
134
- "9400013805","Deferred","","Medium","SMAN-9400013805 | Summary"
135
- "9400013816","Forwarded","","High","SMAN-9400013816 | Summary"
136
- "9400011382","In Process","","Medium","SMAN-9400011382 | Summary"
137
- "9400011393","Information Required","","Medium","SMAN-9400011393 | Summary"
138
- "9400011381","New","","Medium","SMAN-9400011381 | Summary"
139
- "3000016617","No Error","","Medium","SMAN-3000016617 | Summary"
140
- "9400011372","Open","","Highest","SMAN-9400011372 | Summary"
141
- "9400011403","Solution Proposal","","Medium","SMAN-9400011403 | Summary"
142
- "9400011380","Tester Action","","Medium","SMAN-9400011380 | Summary"
143
- "9400011705","Wait for Defect Correction","","Medium","SMAN-9400011705 | Summary"
144
- "9400011437","Wait on External","","Medium","SMAN-9400011437 | Summary"
145
- "9400011466","Withdrawn","Cannot Reproduce","Medium","SMAN-9400011466 | Summary"
146
- "3000017667","Closed","Done","Medium","SMAN-3000017667 | Summary"
147
- "3000018423","No Error","","Medium","SMAN-3000018423 | Summary"
131
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
132
+ "3000017049","Closed","Done","Medium","SMAN-3000017049 | Summary","http://url/to/source/ticket/3000017049"
133
+ "9400011377","Confirmed","","Low","SMAN-9400011377 | Summary","http://url/to/source/ticket/9400011377"
134
+ "3000016618","Defect Correction in Process","","Medium","SMAN-3000016618 | Summary","http://url/to/source/ticket/3000016618"
135
+ "9400013805","Deferred","","Medium","SMAN-9400013805 | Summary","http://url/to/source/ticket/9400013805"
136
+ "9400013816","Forwarded","","High","SMAN-9400013816 | Summary","http://url/to/source/ticket/9400013816"
137
+ "9400011382","In Process","","Medium","SMAN-9400011382 | Summary","http://url/to/source/ticket/9400011382"
138
+ "9400011393","Information Required","","Medium","SMAN-9400011393 | Summary","http://url/to/source/ticket/9400011393"
139
+ "9400011381","New","","Medium","SMAN-9400011381 | Summary","http://url/to/source/ticket/9400011381"
140
+ "3000016617","No Error","","Medium","SMAN-3000016617 | Summary","http://url/to/source/ticket/3000016617"
141
+ "9400011372","Open","","Highest","SMAN-9400011372 | Summary","http://url/to/source/ticket/9400011372"
142
+ "9400011403","Solution Proposal","","Medium","SMAN-9400011403 | Summary","http://url/to/source/ticket/9400011403"
143
+ "9400011380","Tester Action","","Medium","SMAN-9400011380 | Summary","http://url/to/source/ticket/9400011380"
144
+ "9400011705","Wait for Defect Correction","","Medium","SMAN-9400011705 | Summary","http://url/to/source/ticket/9400011705"
145
+ "9400011437","Wait on External","","Medium","SMAN-9400011437 | Summary","http://url/to/source/ticket/9400011437"
146
+ "9400011466","Withdrawn","Cannot Reproduce","Medium","SMAN-9400011466 | Summary","http://url/to/source/ticket/9400011466"
147
+ "3000017667","Closed","Done","Medium","SMAN-3000017667 | Summary","http://url/to/source/ticket/3000017667"
148
+ "3000018423","No Error","","Medium","SMAN-3000018423 | Summary","http://url/to/source/ticket/3000018423"
149
+ """
150
+
151
+ Scenario: Transform with ID originally embedded into the summary
152
+ Given a file named "config/ticket-replicator.mappings.yml" with:
153
+ """
154
+ ---
155
+ field_mapping:
156
+ id: Defect (2)
157
+ summary: Defect (2)
158
+ priority: Defect Priority
159
+ resolution: Defect Status
160
+ status: Defect Status
161
+
162
+ id_extraction_regex: "\\((?<id>\\d+)\\)$"
163
+
164
+ priority_mapping:
165
+ "1: Critical": "Highest"
166
+ "2: High": "High"
167
+ "3: Medium": "Medium"
168
+ "4: Low": "Low"
169
+
170
+ status_mapping:
171
+ defaults_to: keep_original_value
172
+
173
+ resolution_mapping:
174
+ defaults_to: blank_value
175
+ "Fixed": "Done"
176
+ "Closed": "Done"
177
+ "Rejected": "Won't Do"
178
+ "Resolved": "Done"
179
+ "Withdrawn": "Cannot Reproduce"
180
+ """
181
+ And an Excel file named "queue/10.extracted/sap_solution_manager_defects.xlsx"
182
+ And it has a tab named "SAP Document Export" with the following rows:
183
+ | Defect (2) | Defect Priority | Defect Status |
184
+ | Summary (3000017049) | 3: Medium | Closed |
185
+ | Summary (9400011377) | 4: Low | Confirmed |
186
+ | Summary (3000016618) | 3: Medium | Defect Correction in Process |
187
+ | Summary (3000016617) | 3: Medium | No Error |
188
+ | Summary (3000017667) | 3: Medium | Closed |
189
+ Then a file named "queue/10.extracted/sap_solution_manager_defects.xlsx" should exist
190
+ When I successfully run `ticket-replicator --transform`
191
+ Then a file named "queue/20.transformed/sap_solution_manager_defects.csv" should contain exactly:
192
+ """
193
+ "ID","Status","Resolution","Priority","Summary","Source Ticket URL"
194
+ "3000017049","Closed","Done","Medium","SMAN-3000017049 | Summary (3000017049)","http://url/to/source/ticket/3000017049"
195
+ "9400011377","Confirmed","","Low","SMAN-9400011377 | Summary (9400011377)","http://url/to/source/ticket/9400011377"
196
+ "3000016618","Defect Correction in Process","","Medium","SMAN-3000016618 | Summary (3000016618)","http://url/to/source/ticket/3000016618"
197
+ "3000016617","No Error","","Medium","SMAN-3000016617 | Summary (3000016617)","http://url/to/source/ticket/3000016617"
198
+ "3000017667","Closed","Done","Medium","SMAN-3000017667 | Summary (3000017667)","http://url/to/source/ticket/3000017667"
148
199
  """
149
200
 
150
201
  Scenario: Processing an invalid Excel file generates an error with relevant information
151
202
  Given a file named "config/ticket-replicator.mappings.yml" with:
152
203
  """
204
+ ---
153
205
  field_mapping:
154
206
  id: Defect
155
207
  summary: Defect (2)
@@ -185,6 +237,7 @@ Feature: Transform SAP tickets to Jira format
185
237
  Scenario: Processing a file with missing columns generates an error with relevant information
186
238
  Given a file named "config/ticket-replicator.mappings.yml" with:
187
239
  """
240
+ ---
188
241
  field_mapping:
189
242
  id: Defect
190
243
  summary: Defect (2)
@@ -224,6 +277,7 @@ Feature: Transform SAP tickets to Jira format
224
277
  Scenario: Processing a file with an unexpected priority generates an error with relevant information
225
278
  Given a file named "config/ticket-replicator.mappings.yml" with:
226
279
  """
280
+ ---
227
281
  field_mapping:
228
282
  id: Defect
229
283
  summary: Defect (2)
@@ -8,6 +8,10 @@ Feature: Transform and load extracted ticket queue
8
8
  | name |
9
9
  | TICKET_REPLICATOR_JIRA_PROJECT_KEY |
10
10
  | TICKET_REPLICATOR_JIRA_TICKET_TYPE_NAME |
11
+ And the following environment variables have been set:
12
+ | name | value |
13
+ | TICKET_REPLICATOR_SOURCE_TICKET_URL | http://url/to/source/ticket/<%= source_ticket_id %> |
14
+
11
15
  And a file named "config/ticket-replicator.mappings.yml" with:
12
16
  """
13
17
  field_mapping:
@@ -57,20 +61,20 @@ Feature: Transform and load extracted ticket queue
57
61
  And the current date time is "2025-05-10 07:52:00 UTC"
58
62
  When I successfully run `ticket-replicator --ticket-queue-transform-and-load`
59
63
  Then the Jira project should only have the following tickets:
60
- | status | resolution | priority | summary | source ticket url |
61
- | Closed | Done | Medium | SMAN-3000017049 \| Summary | https://example.com/defect/3000017049 |
62
- | Confirmed | | Low | SMAN-9400011377 \| Summary | https://example.com/defect/9400011377 |
63
- | Defect Correction in Process | | Medium | SMAN-3000016618 \| Summary | https://example.com/defect/3000016618 |
64
- | Deferred | | Medium | SMAN-9400013805 \| Summary | https://example.com/defect/9400013805 |
65
- | Forwarded | | High | SMAN-9400013816 \| Summary | https://example.com/defect/9400013816 |
66
- | In Process | | Medium | SMAN-9400011382 \| Summary | https://example.com/defect/9400011382 |
67
- | Information Required | | Medium | SMAN-9400011393 \| Summary | https://example.com/defect/9400011393 |
68
- | Withdrawn | Won't Do | Medium | SMAN-9400011381 \| Summary | https://example.com/defect/9400011381 |
69
- | No Error | | Medium | SMAN-3000016617 \| Summary | https://example.com/defect/3000016617 |
70
- | Open | | Highest | SMAN-9400011372 \| Summary | https://example.com/defect/9400011372 |
71
- | Withdrawn | Won't Do | Medium | SMAN-9400011466 \| Summary | https://example.com/defect/9400011466 |
72
- | Closed | Done | Medium | SMAN-3000017667 \| Summary | https://example.com/defect/3000017667 |
73
- | No Error | | Medium | SMAN-3000018423 \| Summary | https://example.com/defect/3000018423 |
64
+ | status | resolution | priority | summary | source_ticket_url |
65
+ | Closed | Done | Medium | SMAN-3000017049 \| Summary | http://url/to/source/ticket/3000017049 |
66
+ | Confirmed | | Low | SMAN-9400011377 \| Summary | http://url/to/source/ticket/9400011377 |
67
+ | Defect Correction in Process | | Medium | SMAN-3000016618 \| Summary | http://url/to/source/ticket/3000016618 |
68
+ | Deferred | | Medium | SMAN-9400013805 \| Summary | http://url/to/source/ticket/9400013805 |
69
+ | Forwarded | | High | SMAN-9400013816 \| Summary | http://url/to/source/ticket/9400013816 |
70
+ | In Process | | Medium | SMAN-9400011382 \| Summary | http://url/to/source/ticket/9400011382 |
71
+ | Information Required | | Medium | SMAN-9400011393 \| Summary | http://url/to/source/ticket/9400011393 |
72
+ | Withdrawn | Won't Do | Medium | SMAN-9400011381 \| Summary | http://url/to/source/ticket/9400011381 |
73
+ | No Error | | Medium | SMAN-3000016617 \| Summary | http://url/to/source/ticket/3000016617 |
74
+ | Open | | Highest | SMAN-9400011372 \| Summary | http://url/to/source/ticket/9400011372 |
75
+ | Withdrawn | Won't Do | Medium | SMAN-9400011466 \| Summary | http://url/to/source/ticket/9400011466 |
76
+ | Closed | Done | Medium | SMAN-3000017667 \| Summary | http://url/to/source/ticket/3000017667 |
77
+ | No Error | | Medium | SMAN-3000018423 \| Summary | http://url/to/source/ticket/3000018423 |
74
78
  # TODO: And the source ticket URL is found in the ticket descriptions of those tickets
75
79
  And a file named "queue/30.archived/2025-05-10.07h52m00.sap_solution_manager_defects.xlsx" should exist
76
80
  And the file named "queue/10.extracted/sap_solution_manager_defects.xlsx" should not exist anymore
@@ -56,6 +56,7 @@ module Ticket
56
56
  #{extracted_path}:#{row_index}: error while transforming row:
57
57
  #{e.message}:
58
58
  #{row.inspect}
59
+ #{e.backtrace.join("\n")}
59
60
  EOERRORMSG
60
61
  ensure
61
62
  row_index += 1