Skip to content

Conversation

@agnes512
Copy link
Contributor

@agnes512 agnes512 commented Feb 13, 2020

Connects to loopbackio/loopback-datasource-juggler#1816

After investigating, the random CI failures are caused when running autoupdate, the race condition might cause the problem.
OR
It failed to drop table (customer_test2 for example) while doing autouodate, so that it failed to update customer_test2 because the relation still exists.

I've simplified the test case to avoid the second situation:

Before:

Model Order has a foreign key customerId refers Model C2
-(autoupdate)->
Model Order has a foreign key customerId refers Model C3
-(autoupdate)->
Model Order has fk customerId refers Model C2 and fk productId refers to Model Product
-(autoupdate)->
Model Order doesn't have any fks.

Simplified

Model Order has created a foreign key customerId refers Model C2
-(autoupdate)->
Model Order has being updated to have a fk productId refers to Model Product
-(autoupdate)->
Model Order removed all fks.

I think the simplified one also checks that it should create, update, and delete foreign keys.

Please review it with whitespace hided

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • Commit messages are following our guidelines
@agnes512 agnes512 force-pushed the fix-ci branch 8 times, most recently from c11dfbe to a3548fc Compare February 21, 2020 19:26
@agnes512 agnes512 marked this pull request as ready for review February 21, 2020 19:30
@agnes512 agnes512 force-pushed the fix-ci branch 3 times, most recently from 7725b53 to aa9cee6 Compare February 25, 2020 19:34
@emonddr emonddr self-requested a review February 25, 2020 20:19
Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

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

👏 great effort! the test flow is very clear now.

For the new tests:

Model Order has a foreign key customerId refers Model C2
-(autoupdate)->
Model Order has a fk productId refers to Model Product
-(autoupdate)->
Model Order doesn't have any fks.

I could see it tests add and remove, wondering how it test the update? I mean updating the existing fk.

}

// do initial update/creation of table with fk
ds.createModel(product_schema.name, product_schema.properties, product_schema.options);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for providing the test flow, it's very helpful for reviewer. Could you also include it in the code comment?

Like IIUC here should be:
Model Order has a foreign key customerId refers Model C2
Initial update/creation of table with fk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@dhmlau dhmlau added this to the Feb 2020 milestone Feb 26, 2020
Copy link
Contributor

@jannyHou jannyHou left a comment

Choose a reason for hiding this comment

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

👍

@agnes512 agnes512 removed this from the Feb 2020 milestone Feb 27, 2020
@agnes512
Copy link
Contributor Author

@slnode test please

1 similar comment
@agnes512
Copy link
Contributor Author

@slnode test please

@agnes512 agnes512 merged commit a6852c9 into master Feb 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the fix-ci branch February 27, 2020 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants