-
Notifications
You must be signed in to change notification settings - Fork 298
Conversation
test/interface.spec.js
Outdated
// as an empty object | ||
'should not put dag-cbor node with wrong multicodec' | ||
] | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... is this really the preferred approach? I foresee people changing the test title and not understanding why things are failing. I kind of liked when the tests explicitly communicated that it was known it wasn't working with go-ipfs or js-ipfs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right, there's a trade off here that I should have drawn more attention to - if a test name is changed in interface-ipfs-core
and it is skipped in the consumer then it will begin to fail.
These PRs propose to put the responsibility on the implementation to know what tests should be skipped. I don't believe the interface should change based on the implementation/platform/environment. I also don't believe the interface should need to know about all possible implementations. It feels appropriate to me that the implementation should know and encapsulate this information, leaving interface-ipfs-core
as a point of truth, dictating the interface that implementations need to conform to.
I see the advantages as:
- Not having to send a separate PR to
interface-ipfs-core
when enabling already skipped tests or temporarily disabling flaky/buggy/not implemented tests - these PRs are not really forinterface-ipfs-core
, they are forjs-ipfs
orjs-ipfs-api
, but they leak intointerface-ipfs-core
because that's currently the only way to skip/unskip - Having a central location when you can easily see and manage all the tests that are skipped
- Not having to maintain hacks and skips for tests based on all implementations that will ever exist in
interface-ipfs-core
e.g.withPhp
,withJava
,withRuby
- Also if another Go implementation or JS implementation pops up, I don't want the interface to be skipping tests for them when it might not be appropriate to do so
- Discouraging misuse of implementation specific checks, for example I've seen
!withGo
be used when devs actually meanwithJs
, which could easily cause problems in the future when being used against a Java or a Ruby backend (super minor, but worth noting)
The disadvantage:
- If a test name is changed in
interface-ipfs-core
and it is skipped in the consumer then it will begin to fail
I rate the disadvantage as low impact. The frequency of test name changes is low (IMHO) and the chances of a test name changing and it also being a test that is skipped is also low. We should also be striving for no skips which would eradicate the risk completely.
It's your call, and I'm happy to move these back into interface-ipfs-core
- I believe the other changes in these PRs are still valuable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also worth mentioning - we already have a scattering of where this information is held. We have implementation specific skips in interface-ipfs-core (go/js), but platform dependent (browser/node.js) skips in js-ipfs.
For example, some suites don't work in the browser so aren't included https://github.com/ipfs/js-ipfs/blob/2e9418465c863b129300ea5f0c8b32590edc7729/test/core/interface/interface.spec.js#L17-L23 and we have the same thing for functionality that isn't implemented e.g. repo tests simply just not included in js-ipfs because it's not all implemented yet.
These PRs would put all of that information in the same place, which I think is a win.
I'd like to at least try things this way around and if it becomes an issue then we change it back?
What do you think @diasdavid - is worth a try? I'd like to move forwards on these PRs soon because they're becoming difficult to keep up to date with master!
Thank you, much ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for putting so much care and thought into this, @alanshaw ❤️
I won't block you from moving forward but I have one last request. Can we treat the test suite as something definitive and everytime there is something that is skipped (i.e. does not work with go-ipfs) it is up to the implementation to skip the test but also print a log saying that says "go-ipfs incompatible" or something that clearly communicates to the dev that there is missing stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a think about what to do. Some ideas off the top of my head:
Option 1
// instead of
{
skip: ['test1', 'test2']
}
// if passed as an object then interpret it as { skippedTest: 'reason' }
{
skip: {
'test1': 'go-ipfs incompatible',
'test2': 'another reason'
}
}
and causes output in the console like:
...
✓ other test
- test1 (go-ipfs incompatible)
- test2 (another reason)
...
Option 2
// instead of
{
skip: ['test1', 'test2']
}
// if skip array item is an object, extract name & reason
{
skip: [
{ name: 'test1', reason: 'go-ipfs incompatible' },
{ name: 'test2', reason: 'another reason' }
]
}
Too verbose?
Option 3
// instead of
{
skip: ['test1', 'test2']
}
// explicit skip reasons object
{
skip: ['test1', 'test2'],
skipReasons: {
'test1': 'go-ipfs incompatible',
'test2': 'another reason'
}
}
Too weird i think, and detached from skip test names.
...I think option 1 is my fav
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say Option 1 given the example but since some test titles are actually long, Option 2 might serve us better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests.pubsub(CommonFactory.create({ | ||
spawnOptions: { | ||
args: ['--enable-pubsub-experiment'], | ||
initOptions: { bits: 1024 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use 1024
for all tests? It would make things way faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this was actually lost with this change, before all tests used 1024.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They still are, the defaultCommonFactory
passed to other suites uses 1024 by default https://github.com/ipfs/js-ipfs-api/pull/785/files/519bbf5c4374317d5355d9bddfb2fc5862ddd16d#diff-b4ff00e5aeab8b441e96f3d0b1082a2eR12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood! Thanks :)
test/interface.spec.js
Outdated
} | ||
})) | ||
|
||
tests.types(defaultCommonFactory, { skip: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why skip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were not being run before and they fail right now - I'll add a comment
test/interface.spec.js
Outdated
|
||
tests.types(defaultCommonFactory, { skip: true }) | ||
|
||
tests.util(defaultCommonFactory, { skip: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why skip?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were not being run before and they fail right now - I'll add a comment
package.json
Outdated
@@ -75,6 +74,7 @@ | |||
"browser-process-platform": "~0.1.1", | |||
"chai": "^4.1.2", | |||
"cross-env": "^5.1.6", | |||
"detect-node": "^2.0.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: this needs to be moved back into dependencies before merging as it's used in the main code
351dea5
to
d5915a4
Compare
test/interface.spec.js
Outdated
// bitswap.unwant | ||
{ | ||
name: 'should remove a key from the wantlist', | ||
reason: 'FIXME why is this skipped?' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alanshaw does it fail when run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes unfortunately. It was just skipped in interface-ipfs-core before with no explanation.
1) interface-ipfs-core tests
.bitswap.unwant
should remove a key from the wantlist:
Uncaught AssertionError: expected false to equal true
+ expected - actual
-false
+true
at ipfsB.bitswap.wantlist (/Users/alan/Code/protocol-labs/interface-ipfs-core/js/src/bitswap/unwant.js:52:61)
at f (node_modules/once/once.js:25:25)
at streamToValue (src/utils/stream-to-json-value.js:30:5)
at concat (src/utils/stream-to-value.js:12:22)
at ConcatStream.<anonymous> (node_modules/concat-stream/index.js:37:43)
at finishMaybe (node_modules/readable-stream/lib/_stream_writable.js:630:14)
at afterWrite (node_modules/readable-stream/lib/_stream_writable.js:492:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Reduces code repetition, allows test skipping and running only some tests. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
9885db9
to
b02e95b
Compare
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
y no green CI? |
@diasdavid I had this all lined up to be merged asap after After 0.70 was released I saw that there were many issues on CI that didn't appear at all when run locally. Jenkins had a bad day last week coinciding with the release so it's been difficult and slow to debug and resolve the issues. I now have a PR open on I'm super anxious to get this and ipfs/js-ipfs#1389 merged asap because they're both depending on 0.69.x still. It's confusing and frustrating the community when trying to add tests to interface-ipfs-core right now 😞 |
FYI @diasdavid the 2 DAG tests that are failing here will be fixed by this PR #801 |
* fix(dag): ensure `dag.put()` allows for optional options This is to align with API changes made in ipfs-inactive/interface-js-ipfs-core@011c417 and ipfs/js-ipfs#1415 License: MIT Signed-off-by: Pascal Precht <pascal.precht@gmail.com> * fix(dag): fixes to allow options to be optional License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update ipfsd-ctl dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: increase timeout for addFromURL with wrap-with-directory Sadly we can't guarantee ipfs.io will respond within 5s License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
The offline tests create and stop a node. ipfs/kubo#4078 seems to not only be restricted to windows. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
@diasdavid gr gr gr greeeeeeen! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RAD! <3 @alanshaw
* feat: uses modular interface tests Reduces code repetition, allows test skipping and running only some tests. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: skip unimplemented files tests and add ls* tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: adds skips for ipfs-inactive#339 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: adds skips for key and miscellaneous License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: add types and util tests (skipped as currently failing) License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * feat: add pin tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix(pubsub): adds skips for tests on windows License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix(config): adds skip for config.replace License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: re-adds bitswap tests License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: move detect-node back to dependencies License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: add skip reasons License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: add reason for pubsub in browser skips License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: add bitswap skips for offline errors License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: remove skip for test that was removed License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core version License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update deps and test on CI (ipfs-inactive#802) * chore: update interface-ipfs-core * fix(dag): `dag.put()` allows for optional options (ipfs-inactive#801) * fix(dag): ensure `dag.put()` allows for optional options This is to align with API changes made in ipfs-inactive/interface-js-ipfs-core@011c417 and ipfs/js-ipfs#1415 License: MIT Signed-off-by: Pascal Precht <pascal.precht@gmail.com> * fix(dag): fixes to allow options to be optional License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update interface-ipfs-core dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * chore: update ipfsd-ctl dependency License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: increase timeout for addFromURL with wrap-with-directory Sadly we can't guarantee ipfs.io will respond within 5s License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io> * fix: skip bitswap offline tests on all platforms The offline tests create and stop a node. ipfs/kubo#4078 seems to not only be restricted to windows. License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
This PR updates js-ipfs-api to use the new interface-ipfs-core tests. This gives us fine grained control over what tests we run.
Please see the description on the PR for more information on the reasons behind this change.
This also enables a bunch of tests that weren't previously being run 🎉 ...and removes a LOT of duplicated code for running the interface tests.
requires ipfs-inactive/interface-js-ipfs-core#290