-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review feedback #7
Comments
@bajtos Thanks for the review, I will work on these today. Some quick thoughts on non-code issues:
2 and 3: I will look into the tests today to make sure everything works right now (unlikely, but then I can fix them)
|
I think some of our connectors are using Artistic 2.0 license. @markdirish, I just realized there's no CLA or DCO set up in this repo (unless i'm missing something). We're trying to move from CLA to DCO (still in process!), so I'd recommend you to use DCO as the contribution method. If you agree, I can enable it for you. I think it needs admin for the github org to do that. |
Our team is also using DCO, so it would be great to set up here as well! |
It's enabled now! :) You might want to update the For your reference, here is the CONTRIBUTING.md in one of our DCO-enabled repo: https://github.com/strongloop/loopback.io-search/blob/master/CONTRIBUTING.md |
IBM i is an entire OS (with integrated Db2 DBMS), so it can't really be run in Docker. There are finally ways to run IBM i in IBM Cloud, SkyTap, and Google Cloud. They're all pretty early on and there currently isn't any commercial CI system built around them, either. Our team is actively working on enabling some sort of IBM i CI system for OSS, though. |
@bajtos , I have been working on this a lot lately, and have my connector passing 100% of the tests in I notice that There is a much newer version, 4.12.1. Should I target the tests in that version instead? Similarly, I have an outdated version of I have tinkered around with the new versions, but there are things that don't seem to be working quite right. If you let me know what dependency versions I should target, I can analyze further and post the issues I'm having. Thanks! |
I have pushed my latest changes to https://github.com/markdirish/loopback-connector-ibmi/tree/master I updated the dependencies for Consistently, when a test calls Model.create and only passes in a function, I am getting a blank object back (doesn't have the ID or any attributes). For instance: When https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/dao.js#L375-L383 However, by the time gets to line 424, the object appears to be the blank object that is returned to the test. Is this an issue with my connector, with these tests, or with the datasource-juggler? Thanks! |
Ok, I have resolved my id issue (seems like it was defaulting to 0, when it should have been defaulting to 1, and was failing silently somewhere). Now have 658 passing tests and 11 failing. Will try to run tests against v3 and v4 as you mention above. |
@bajtos , I think I am nearing completion of getting All of the code I am referencing can be found at: https://github.com/markdirish/loopback-connector-ibmi/tree/master/. I copied the test structure from loopback-connector-mysql and loopback-connector-mongodb
Not sure if you have any clues what might be the issue, or if there is any common logic to
Looking forward to getting this out in the wild, any guidance you could give would be great! |
@markdirish I am often overwhelmed with GitHub notifications, sorry for responding so late. Feel free to ping me via Slack in the future to get a faster response. I'll try to set aside some time later this week or next week to review the new codebase. In the meantime, can you update your dependencies like |
Totally understand, I feel the same way. Thanks for the Slack permission, I might exercise that from time to time! I will update these dependencies tomorrow and add to the PR, I'm always a proponent of reducing the size of |
@markdirish sorry for keeping you waiting for so long. What's the current status of your work? Where can I find the latest codebase to review? (I remember there was some confusion around the relation between https://github.com/strongloop/loopback-connector-ibmi and https://github.com/markdirish/loopback-connector-ibmi)? |
PRs made to fix some tests for loopbackio/loopback-datasource-juggler#1810 |
Issues I am still encountering:
However, in order to get a connection, many of the datasource-juggler tests run:
The problem is, it checks if db is undefined (such as when the first test suite is run), and if it is, it will create a How are other connectors getting around this (possibly they use synchronous/constructor connections?), and how can I get around it?
produces the query:
(and binding 2 to the parameter marker). The problem is, the Tool it is looking for exists in the Tools table, but not in the Product table. So the query returns nothing (since the Product table is empty) and the test fails. I think there is some wider issue with relationships going on, but might need a little more expertise to know what. |
@strongloop/sq-lb-apex @bajtos, any insights on the above comment? Thanks. |
The code in question can be found at https://github.com/markdirish/loopback-connector-ibmi In regards to the first issue, it seems to run fine if I run a Is it a difference between the versions of the juggler, or perhaps how where the tests are? v3 datasource-juggler code lives in |
When I run just default scope tests for v3, with trace stacks when: 1. getSchema is called, 2. when ibmiconnector.initialize is called, and 3. when the call to odbc.pool returns inside ibmiconnector.initialize:
And then, since the pool has been created (at least 1 open connection has been returned), it executes fine. When I run the same code, with the same
BUT it starts executing SQL statements here, not waiting until pool returns. So it starts erroring immediately. Still digging... |
Issue 1, with connections trying to run SQL commands before the datasource has connected, are caused by the following line: This logic did not exist in v3. In v3, everything seems to execute in order, but in v4 it doesn't wait for the pool to connect, causing errors. |
Juggler supports asynchronous connector initialization, that's why many methods (including In the constructor (the exported The connector should implement Here are the relevant bits from the PostgreSQL connector:
See also the code in
IIRC, in v3, it was the responsibility of the caller of I believe this works well for existing connectors. Now since it does not work for |
See #9 (comment) |
I am closing this issue as done via #9. |
@markdirish , are you planning to open a PR to https://github.com/strongloop/loopback.io? |
I guess I didn't realize the site was on the GitHub! I will work on a PR to post about the new connector |
I quickly skimmed through the code base in https://github.com/markdirish/loopback-connector-ibmi, the code looks reasonably. I have few suggestions & discussion points. /cc @markdirish
(1)
The code handling transactions in
executeSQL
does not look right to me. If I understand it correctly, then it's opening a new transaction for every SQL command executed - that's not what we want. Instead, the code should execute the given SQL command within the given transaction that has been opened previously, see how our PostgreSQL connector handles that here.(2)
The connector should run tests for operation hooks in addition to "common.batch" and "include.test".
(3)
Ideally, the connector should run tests from both v3 and v4 versions of juggler. See loopbackio/loopback-connector-mongodb#519 for inspiration.
(4)
I noticed that eslint is configured with airbnb style, it would be nice to use LoopBack presets instead.
(5)
It's not clear how to run tests locally and AFAICT, there is no CI configured. How are we going to verify pull requests? Will each change require a manual run of the tests? It would be great if there was a way how to run DB2 on IBMi via Docker, that would simplify dev setup and allow us to run tests on Travis CI too.
(6)
There are two repositories ATM: https://github.com/markdirish/loopback-connector-ibmi and https://github.com/strongloop/loopback-connector-ibmi, these two repos seems to be out of sync. We should pick one that will server as the single source of truth, bring it up to date with the latest working version, and update URLs in
package.json
so that they all point to the same repository.ATM, the URLs are mixed:
https://github.com/strongloop/loopback-connector-ibmi/blob/6103967a0e4cc7eaf1b150c41b19987ad0b3bc4b/package.json#L45-L52
(7)
Last but not least, the license field in package.json says
Artistic-2.0
. AFAIK, IBM prefers Apache 2.0 or MIT for open source projects. We are using MIT in StrongLoop repos, I think we should use the same license for this connector too.The text was updated successfully, but these errors were encountered: