-
Notifications
You must be signed in to change notification settings - Fork 86
Add temporary code for field rename #2333
Add temporary code for field rename #2333
Conversation
Codecov Report
@@ Coverage Diff @@
## osio-story-743-rename-fields #2333 +/- ##
===============================================================
Coverage ? 70.12%
===============================================================
Files ? 171
Lines ? 16641
Branches ? 0
===============================================================
Hits ? 11670
Misses ? 3840
Partials ? 1131
Continue to review full report at Codecov.
|
0f6ea31
to
8fa69e3
Compare
1e42789
to
541a9b3
Compare
Add `None` to a Defect's resolution in the Agile space template and make it the default resolution by putting it in first place. See openshiftio/openshift.io#3832
89388c4
to
ceb3034
Compare
ceb3034
to
31d7ccf
Compare
[test] |
Codecov Report
@@ Coverage Diff @@
## osio-story-743-rename-fields #2333 +/- ##
===============================================================
Coverage ? 70.18%
===============================================================
Files ? 171
Lines ? 16641
Branches ? 0
===============================================================
Hits ? 11680
Misses ? 3833
Partials ? 1128
Continue to review full report at Codecov.
|
Previously the [deployment failed](fabric8-services#2334 (comment)): ``` failed to overwrite default of old field type with None (string): failed to set default value of enum type to None (string): value: None (string) is not part of allowed enum values: [Done Duplicate Incomplete Description Can not Reproduce Deferred Won't Fix Out of Date Verified] file: spacetemplate/importer/repository.go line: 91 ``` We've updated the resolution enum to have a new value and that is also the new default. That new value didn't exist in the old enum type but we tried to make it the new default for the old type anyways. That didn't work because the `FieldType.SetDefault()` implementation for enums checks if the given value is part of the allowed enum values. The overall intention is to check if too enums are the same but ignore the default value. That is why we temporarily make both defaults the same before we call `FieldType.Equal()`. With this change we simply reverse the assignment of the new default to the old type. Instead we temporarily assign the old default to the new type. The result is that a call to `FieldType.Equal()` will return true.
We want to use this file in Github to automatically assign reviewers to PRs if they are declared as "owners". Read more about this file here: * https://blog.github.com/2017-07-06-introducing-code-owners/ * https://help.github.com/articles/about-codeowners/ So far I've added only "my" parts and the ones I feel deeply responsible for. We can add more code owners later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarifibrahim overall it looks good I had some questions that were answered while reading through but maybe you can give a confirmation or a thumbs up when my conclusion was right.
controller/test-files/search/show/filter_assignee_null_show_after_update_work_item.golden.json
Show resolved
Hide resolved
controller/test-files/work_item/list_children/ok.res.payload.golden.json
Outdated
Show resolved
Hide resolved
@@ -13,15 +13,15 @@ | |||
"kind": "area" | |||
} | |||
}, | |||
"system.area": { | |||
"system_area": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UI potentially makes use of these field information. @sudsen, do you parse the WIT description that the backend returns and do you search for fields inside of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #2333 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarifibrahim In the comment you referred to @sudsen said that the UI ignores _
fields:
UI will simply ignore '_' values for now.
But here you're replacing a field and the UI will not be able to find the area
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This PR replaces system.area
with system_area
because /workitemtype
response isn't fixed in this PR. I have changed in separately in #2335 (see the golden file https://github.com/fabric8-services/fabric8-wit/pull/2335/files#diff-d743767476fe0f409baa3070f7728acc)
c105466
to
04b430f
Compare
@@ -87,11 +87,22 @@ | |||
"system.description.rendered": "\u003cp\u003e\u003ccode\u003e(see function github.com/fabric8-services/fabric8-wit/controller_test.(*workItemLinkSuite).TestList in controller/work_item_link_blackbox_test.go)\u003c/code\u003e\u003c/p\u003e\n", | |||
"system.metastate": null, | |||
"system.number": 1, | |||
"system.order": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is the system.order
1 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1
looks wrong to me. I don't know why it was 1
Before only the last range variable was being used and some tests just passed when the shouldn't have. See also https://gist.github.com/posener/92a55c4cd441fc5e5e85f27bca008721. And https://golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks for capturing range variables. Thanks to @michaelkleinhenz for finding this and @jarifibrahim for finding the solution which is well known but in this case it is just too easy to miss.
…ric8-services/fabric8-wit into osio-story-743-rename-fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, we can merge this to your branch.
* Rename system.* to system_* in a all files (#2330) * Update branch osio-story-743-rename-fields (#2350) * Add temporary code for field rename (#2333) * Add replaceFieldName and addFieldName with tests * Remove unnecessary log.Error from golden_files_test.go * Fix failing test in expression_compiler_blackbox_test.go * Skip FullTextSearch and iteration test until migrations are added * Add golden files with old and new field names * Add todo to skipped tests * Add foo.bar test for expression_compiler * Update /workitemtype response for field rename (#2335) * Change workitemtype response payload * Update golden files related to workitemtype response change * Add onField to the /workitem/event response (#2337) * Add event_name attribute to the event response * fix golden files related to workitem_event * Rename event_name to onField in event/show response * Update golden files * Add migrations for field name rename (#2340) * Add migration for workitem_type field renames * Add field rename migrations for work_items and work_item_revisions table * Enable skipped test for field rename and update TSV trigger (#2342) * Add migration for TSV vector and triggers for field renames * Change migration file names
This PR builds upon #2330. I will update this PR once #2330 is merged.Blocked by #2345See #2343
The PR -
Fixes tests in expression_compiler d0e6171
Skips full text search tests and tests that depend on database triggers 08a84da
The full text search depends on the TSV which are not yet fixed and the
IfModifiedSince
tests depend on the triggers defined onwork_item
table. We have not yet fixed a database and it's causing test failures. I have created an issue for this Re-introduce skipped tests #2332.Adds
replaceFieldName
(incoming/request workitem payload) andaddFieldName
(outgoing/response payload) with tests 99154fcThe request and response payload for /workitem(s) endpoint has changed
Updates all the Golden Files 31d7ccf
Todo
/workitemtype
endpoint response payload Update /workitemtype response for field rename #2335/workitem/events
endpoint response to return appropriate response (We can't send all the events twice) Add onField to the /workitem/event response #2337