loopbackio / loopback-connector-oracle

Connect Loopback to Oracle
http://loopback.io/doc/en/lb3/Oracle-connector.html
Other
28 stars 30 forks source link

Update test script #128

Closed 0candy closed 7 years ago

0candy commented 7 years ago

Backport of #108

Description

Related issues

Checklist

loay commented 7 years ago

@slnode test please

rmg commented 7 years ago

@slnode test please

0candy commented 7 years ago

Windows machine failing with Error: The specified module could not be found.

jannyHou commented 7 years ago

Sorry for jumping in this PR, I made a new commit just to test if a new commit can rerun the test with latest build and fix the problem on windows machine. A new commit sometime solves the problem that slnode command couldn't.

b-admike commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

rmg commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

ssh24 commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

loay commented 7 years ago

@slnode test please

loay commented 7 years ago

@ssh24 honestly I don't see the point, since the seg fault is only happening when you run the test cases in windows, and it is not really code-related. @jannyHou it should be able to support it, but it doesn't seem to be available on CI, when I tried to run it. I can re-enable it to get the exact error message where both 0.10 and 0.12 were not available.

ssh24 commented 7 years ago

So the segmentation fault does not happen with any use case? Just a CI failure?

loay commented 7 years ago

yes, it happens when I run tests on windows machine.

ssh24 commented 7 years ago

I mean, does it happen because of the test case (i.e if the user tries to do the same scenario as the test case, will give it a segmentation fault?) or just a CI configuration failure?

loay commented 7 years ago

@ssh24 Oh I see what you mean. It is not a CI configuration issue. If a user tries to insert a duplicate instance for example (which is one of the things that cause seg fault), then there should be the duplicate error from loopback but I cannot confirm 100% if they will get a Mocha seg. fault, caused by the c++ pointers in the driver. As for documenting the issue, I believe it is unnecessary since the user should be just getting the normal error message when they are using the connector. I am just trying to backport a script that simply runs instead of the current one until we upgrade completely to 3.x

cjbj commented 7 years ago

If a user tries to insert a duplicate instance for example (which is one of the things that cause seg fault), then there should be the duplicate error from loopback but I cannot confirm 100% if they will get a Mocha seg. fault, caused by the c++ pointers in the driver.

In the node-oracledb driver itself? Can someone check into this more (@raymondfeng)?

loay commented 7 years ago

@cjbj it is happening with 2.x only . Current version on master is working fine.

cjbj commented 7 years ago

@loay

it is happening with 2.x only . Current version on master is working fine.

Can you post a code sample that fails to the node-oracledb repo? Also check you have the latest node-oracledb dev-2.0 branch code, since I did a push last week.

rmg commented 7 years ago

@cjbj @loay it looks like you might be misunderstanding each other.

I think in the comments in this PR 2.x, 3.x, and master, in all cases you are referring to this repo (loopback-connector-oracle), and not node-oracledb.

@loay is that correct?

cjbj commented 7 years ago

@rmg, I had originally asked

In the node-oracledb driver itself?

so I could only assume the answer was related to that.

loay commented 7 years ago

yes exactly, I meant 2.x and 3.x of the repo loopback-connector-oracle.

loay commented 7 years ago

Hi @cjbj In order to reproduce the segmentation fault, you will need to be on a windows machine, then checkout this branch: 2.x and then run the tests npm test.

I don't think it has anything to do with the new driver, as the new driver is working fine in the the master branch (version 3.x of loopback-connector-oracle).

In 2.x, it is still using strong-oracle, which is already deprecated. There is an issue already to deprecate 2.x of loopback-connector-oracle.

Segmentation fault happens mainly because of the following test cases: in oracle.test.js

  it('should escape number values to defect SQL injection in findById',
    function(done) {
      Post.findById('(SELECT 1+1)', function(err, p) {
        should.exists(err);
        done();
      });
    });

  it('should escape number values to defect SQL injection in find',
    function(done) {
      Post.find({where: {id: '(SELECT 1+1)'}}, function(err, p) {
        should.exists(err);
        done();
      });
    });

  it('should escape number values to defect SQL injection in find with gt',
    function(done) {
      Post.find({where: {id: {gt: '(SELECT 1+1)'}}}, function(err, p) {
        should.exists(err);
        done();
      });
    });

  it('should escape number values to defect SQL injection in find',
    function(done) {
      Post.find({limit: '(SELECT 1+1)'}, function(err, p) {
        should.exists(err);
        done();
      });
    });

  it('should escape number values to defect SQL injection in find with inq',
    function(done) {
      Post.find({where: {id: {inq: ['(SELECT 1+1)']}}}, function(err, p) {
        should.exists(err);
        done();
      });
    });

as well as this one:

in loopback-datasource-juggler/test/manipulation.test.js

   bdd.itIf(connectorCapabilities.refuseDuplicateInsert !== false, 'should refuse to create ' +
    'object with duplicate id', function(done) {
      // NOTE(bajtos) We cannot reuse Person model here,
      // `settings.forceId` aborts the CREATE request at the validation step.
      var Product = db.define('ProductTest', {name: String}, {forceId: false});
      db.automigrate('ProductTest', function(err) {
        if (err) return done(err);

        Product.create({name: 'a-name'}, function(err, p) {
          if (err) return done(err);
          Product.create({id: p.id, name: 'duplicate'}, function(err, result) {
            if (!err) {
              return done(new Error('Create should have rejected duplicate id.'));
            }
            err.message.should.match(/duplicate/i);
            done();
          });
        });
      });
    });

Please let me know if you need more clarification.

cjbj commented 7 years ago

@loay if it's not a problem with node-oracledb, I'll step out of the loop. Thanks for clarifying.