Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Conversation

jarifibrahim
Copy link
Member

@jarifibrahim jarifibrahim commented Oct 29, 2018

This PR builds upon #2330. I will update this PR once #2330 is merged.

Blocked by #2345

See #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 on work_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) and addFieldName (outgoing/response payload) with tests 99154fc
    The request and response payload for /workitem(s) endpoint has changed

  • Updates all the Golden Files 31d7ccf

Todo

@codecov
Copy link

codecov bot commented Oct 29, 2018

Codecov Report

❗ No coverage uploaded for pull request base (osio-story-743-rename-fields@5300ce5). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@                       Coverage Diff                       @@
##             osio-story-743-rename-fields    #2333   +/-   ##
===============================================================
  Coverage                                ?   70.12%           
===============================================================
  Files                                   ?      171           
  Lines                                   ?    16641           
  Branches                                ?        0           
===============================================================
  Hits                                    ?    11670           
  Misses                                  ?     3840           
  Partials                                ?     1131
Impacted Files Coverage Δ
workitem/workitemtype.go 73.62% <ø> (ø)
controller/workitem.go 81.72% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5300ce5...31d7ccf. Read the comment docs.

@jarifibrahim jarifibrahim changed the base branch from master to osio-story-743-rename-fields October 29, 2018 08:00
@jarifibrahim jarifibrahim force-pushed the osio-story-743-part-1-temp-code branch 2 times, most recently from 0f6ea31 to 8fa69e3 Compare October 29, 2018 08:58
@jarifibrahim jarifibrahim force-pushed the osio-story-743-part-1-temp-code branch 2 times, most recently from 1e42789 to 541a9b3 Compare October 29, 2018 09:17
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
@jarifibrahim jarifibrahim force-pushed the osio-story-743-part-1-temp-code branch from 89388c4 to ceb3034 Compare October 29, 2018 12:10
@jarifibrahim jarifibrahim force-pushed the osio-story-743-part-1-temp-code branch from ceb3034 to 31d7ccf Compare October 29, 2018 12:14
@jarifibrahim
Copy link
Member Author

[test]

@jarifibrahim jarifibrahim changed the title WIP - Add temporary code for field rename Add temporary code for field rename Oct 30, 2018
@codecov-io
Copy link

codecov-io commented Oct 30, 2018

Codecov Report

❗ No coverage uploaded for pull request base (osio-story-743-rename-fields@b942caf). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@                       Coverage Diff                       @@
##             osio-story-743-rename-fields    #2333   +/-   ##
===============================================================
  Coverage                                ?   70.18%           
===============================================================
  Files                                   ?      171           
  Lines                                   ?    16641           
  Branches                                ?        0           
===============================================================
  Hits                                    ?    11680           
  Misses                                  ?     3833           
  Partials                                ?     1128
Impacted Files Coverage Δ
workitem/workitemtype.go 73.62% <ø> (ø)
controller/workitem.go 81.72% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b942caf...fc9ed88. Read the comment docs.

kwk added 2 commits October 30, 2018 12:59
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.
Copy link
Collaborator

@kwk kwk left a 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/golden_files_test.go Show resolved Hide resolved
controller/iteration_blackbox_test.go Show resolved Hide resolved
@@ -13,15 +13,15 @@
"kind": "area"
}
},
"system.area": {
"system_area": {
Copy link
Collaborator

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

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?

Copy link
Member Author

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)

controller/workitem_whitebox_test.go Show resolved Hide resolved
controller/workitem_whitebox_test.go Show resolved Hide resolved
controller/workitem_whitebox_test.go Show resolved Hide resolved
controller/workitem_whitebox_test.go Outdated Show resolved Hide resolved
workitem/expression_compiler_blackbox_test.go Show resolved Hide resolved
@jarifibrahim jarifibrahim requested a review from baijum November 8, 2018 12:52
@@ -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,
Copy link
Contributor

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

Copy link
Member Author

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

kwk and others added 4 commits November 13, 2018 10:16
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.
Copy link
Contributor

@baijum baijum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@kwk kwk left a 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.

@jarifibrahim jarifibrahim merged commit efb6a38 into fabric8-services:osio-story-743-rename-fields Nov 26, 2018
jarifibrahim added a commit that referenced this pull request Jan 22, 2019
* 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants