Skip to content
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

Create Test_edge_creation #119

Merged
merged 9 commits into from
Jul 10, 2015
Merged

Create Test_edge_creation #119

merged 9 commits into from
Jul 10, 2015

Conversation

tommykennedy
Copy link
Contributor

Hi Dario

I hope this test is attached now

Tom

EDIT: adds failing test for #116


var self = this;

describe('Issue: Found class name null', function () {
Copy link
Member

Choose a reason for hiding this comment

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

Please replace "Issue:" for "Bug #116:" so it will be listed among the other bugs in the build log, example: https://travis-ci.org/appscot/sails-orientdb/jobs/69971485#L1258

@dmarcelino
Copy link
Member

Hey @tommykennedy, made few inline comments. Because the file doesn't end with .js it didn't run. Please fix the aforementioned things and commit to the same branch. Cheers

@tommykennedy
Copy link
Contributor Author

I have updated the file with your instructions and appended .js to the filename.

@dmarcelino
Copy link
Member

So it seems your test is actually passing (https://travis-ci.org/appscot/sails-orientdb/jobs/70070905#L1265):

  Bug #116: Found class name null
    Create answer
  ✓ should add answer and create edge answered from answer to questions (38ms)

Can it be that your model definition is slightly different from the one used in the test?

@tommykennedy
Copy link
Contributor Author

I ran the test on my machine and it fails it with the error.

Im using the following configuration below.

OrientDB Server v2.0.1

"name": "sails-orientdb",
"version": "0.10.55",

@dmarcelino
Copy link
Member

Can you try upgrading your OrientDB server to v2.0.12 to dismiss any potential OrientDB change?

The only thing that changed in master branch after v0.10.55 was updating dependencies, you can try that locally... but it's unlikely it would cause this issue.

@tommykennedy
Copy link
Contributor Author

I upgraded to 2.0.12 and deleted sails-orientdb and reinstalled it npm install sails-orientdb. The exact output I get is.

  1. Bug Found class name null or empty #116: Found class name null Create answer should add answer and create edge answered from answer to questions:
    [Error (E_UNKNOWN) Encountered an unexpected error] Details: OrientDB.RequestError: Found class name null or empty

Error (E_UNKNOWN) :: Encountered an unexpected error
Error (E_UNKNOWN) :: Encountered an unexpected error
OrientDB.RequestError: Found class name null or empty
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)

@tommykennedy
Copy link
Contributor Author

I ran the test script on another machine with Orient 2.0.12 and npm install sails-orientdb. I created the test script in /test/integration-orientdb/bugs and executed npm test.

Same error

Did you use the last updated 116-test_edge_creation.js in the test?

@tommykennedy
Copy link
Contributor Author

I figured out how to turn debugging on and the output is below. Im not sure why answer gets an @Class property within the embedded type. Also why is there another type field with value document. I would have expected this to be in the @type field.
E.g
{ Answer: { '@type': 'd', '@Class': '', type: 'document', binary: 'Yes' }

Bug #116: Found class name null
sails-orientdb:adapter:debug registerConnection: db=test_bug_116 , connection=test_bug_116 +2ms
sails-orientdb:connection:info Connecting to database... +0ms
sails-orientdb:edge:debug getEdgeSides: finding vertexes for: answer_question__questions_answers +2ms
sails-orientdb:edge:debug getEdgeSides: match found for answer_question: question +0ms
sails-orientdb:edge:debug getEdgeSides: match found for questions_answers: answers +0ms
sails-orientdb:edge:info Edge [answer_question__questions_answers] has changed its tableName to [answered] +0ms
sails-orientdb:connection:info Database test_bug_116 not found, will create it. +3ms
sails-orientdb:adapter:debug describe: Answer +19ms
sails-orientdb:adapter:debug describe: Answer +1ms
sails-orientdb:adapter:debug define: Answer +0ms
sails-orientdb:adapter:debug describe: Questions +9ms
sails-orientdb:adapter:debug describe: Questions +1ms
sails-orientdb:adapter:debug define: Questions +0ms
sails-orientdb:adapter:debug describe: answer_question__questions_answers +10ms
sails-orientdb:adapter:debug describe: answer_question__questions_answers +0ms
sails-orientdb:adapter:debug define: answer_question__questions_answers +0ms
sails-orientdb:connection:info All classes created, post processing +10ms
Create answer
sails-orientdb:document:debug Insert into [Questions] values: [object Object]
Inspected object #1
{ question: 'This should work, shouldnt it?',
createdAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST),
updatedAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST) } +9ms
sails-orientdb:document:debug Insert result id: { cluster: 12, position: 0 } +1ms
sails-orientdb:document:debug Insert into [Answer] values: [object Object]
_Inspected object #1

{ Answer: { binary: 'Yes', '@type': 'd' },
createdAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST),
updatedAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST) } +1ms
sails-orientdb:document:debug Insert result id: { cluster: 11, position: 0 } +1ms
sails-orientdb:document:debug Update [Answer] with values: [object Object]
_Inspected object #1

{ Answer: { '@type': 'd', '@Class': '', type: 'document', binary: 'Yes' },
createdAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST),
updatedAt: Wed Jul 08 2015 21:26:54 GMT+0100 (BST),
'@Rid': '#11:0' } +1ms
sails-orientdb:document:debug Update where query: @Rid = :param0 +0ms
sails-orientdb:document:debug Update params: { param0: { cluster: 11, position: 0 } } +0ms
sails-orientdb:document:error Failed to update, error: OrientDB.RequestError: Found class name null or empty
_Stack trace #1

OrientDB.RequestError: Found class name null or empty

@tommykennedy
Copy link
Contributor Author

Dario

Have you tried running the test script on your local machine? I build passed on travis for me also. Im totally stumped as it has failed on 2 separate machines now.

@dmarcelino
Copy link
Member

I was just doing that :), the test passed against OrientDB v2.0.10:

  Bug #116: Found class name null or empty
    Create answer
      ✓ should add answer and create edge answered from answer to questions

Which OS are you using btw? My machine is a Mac while travis runs on linux (not sure which).

@tommykennedy
Copy link
Contributor Author

Im running Mac OS X Yosemite 10.10.3

My debug output looks strange.

Let me download 2.0.10 and check that.

@dmarcelino
Copy link
Member

I'm still on Mavericks but I would be surprised if that was the source of our different results.

Meanwhile I've submitted tommykennedy#1 in an attempt to fix the issue. Can you please try it and report back?

@tommykennedy
Copy link
Contributor Author

Eureka. That fixes it and the edges get created.

There seems to be an extra type property getting added also below
{"@type":"document","@Version":0,"binary":"yes","type":"document"}

Could it got to do with any global libraries such as an older version of oriento being used?

…ass` if it's null or empty to allow user's submitted classes
@dmarcelino
Copy link
Member

Good to hear that!

When sails-orientdb retrieves records from OrientDB it gets that metadata. It attempts to clean it where possible though I don't think it's cleaning it for embedded records... It seems the data is being added but it's really just saving what was retrieved.

I've made an improvement to the workaround (10299b1), please test. Once you merge tommykennedy#1 I'll be able to merge this PR.

appscot#116: attempt to fix error on edge creation
dmarcelino added a commit that referenced this pull request Jul 10, 2015
@dmarcelino dmarcelino merged commit f1dc1ca into appscot:master Jul 10, 2015
@dmarcelino
Copy link
Member

Thanks @tommykennedy for the report and test!

@tommykennedy
Copy link
Contributor Author

No problem happy to contribute and I learned a lot to contribute more in the future

Sent from my iPhone

On 10 Jul 2015, at 12:56, Dário [email protected] wrote:

Thanks @tommykennedy for the report and test!


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants