Skip to content

test(scenarios): add createDataSet smoke scenario - #153

Open
galargh wants to merge 1 commit into
mainfrom
galargh/createdataset-smoke-test
Open

test(scenarios): add createDataSet smoke scenario#153
galargh wants to merge 1 commit into
mainfrom
galargh/createdataset-smoke-test

Conversation

@galargh

@galargh galargh commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Related to #121

This introduces createDataSet scenraio described in the related issue. Combined with the other proposed additions related to the issue, it will allow us to fully test the partial upgrade scenario.

Testing

  • CI
  • Nightly Build - TODO

@FilOzzy FilOzzy added this to FOC Jul 16, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Jul 16, 2026
@galargh
galargh force-pushed the galargh/createdataset-smoke-test branch 2 times, most recently from ab542e0 to 00a1da1 Compare July 19, 2026 14:00
@galargh
galargh force-pushed the galargh/createdataset-smoke-test branch 2 times, most recently from 7d8a304 to 7e19448 Compare July 27, 2026 19:00
@galargh
galargh force-pushed the galargh/createdataset-smoke-test branch from 7e19448 to b21e5d7 Compare July 27, 2026 19:01
@galargh galargh changed the title Add createDataSet smoke scenario test(scenarios): add createDataSet smoke scenario Jul 27, 2026
@galargh
galargh marked this pull request as ready for review July 29, 2026 20:08

@galargh galargh Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TLDR

  1. Load devnet-info.json.
  2. Pick USER_2 by default.
  3. Pick the first approved PDP service provider.
  4. Build a Synapse client for that user on the devnet chain.
  5. Create unique smoke-test metadata so this dataset can be identified later.
  6. Ask the SDK to create a storage context for that provider and metadata.
  7. Run synapse.storage.prepare(...) for a tiny dataset size.
  8. If prepare says funds or approvals are needed, submit those transactions:
    • ERC20 approval
    • FilecoinPay deposit
    • FWSS operator approval
  9. Directly call SP.createDataSet(...).
  10. Wait for SP.waitForCreateDataSet(...) to confirm dataset creation.
  11. Fetch datasets through synapse.storage.findDataSets().
  12. Assert the new dataset exists and has the expected properties:
    • positive dataset ID
    • live
    • managed
    • correct payer
    • correct provider/payee
    • matching smoke metadata

@galargh
galargh requested review from BigLep, rjan90 and rvagg July 29, 2026 20:16
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Jul 30, 2026
Comment thread scenarios/run.py
ORDER = [
("test_containers", 5),
("test_basic_balances", 10),
("test_create_dataset_smoke", 300),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this will cause the 300-second outer timeout to win before the 280-second Node timeout whenever cloning, installing, and building takes more than 20 seconds. That bypasses the inner timeout/retry handling and can lose buffered diagnostics. Non-blocking, but I’d give the outer scenario timeout enough headroom for setup plus the Node timeout and retries.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, good catch!

Comment on lines +154 to +161
const context = await synapse.storage.createContext({
providerId: provider.id,
metadata,
withCDN: false,
})
assert(context.dataSetId == null, `Expected unique metadata to create a new data set, got ${context.dataSetId}`)

await prepareWithPlainErc20(synapse, context)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's unfortunate that you need to make a context just to get the proper prepare & costing setup; opened an issue for this but for now you're right about needing to do it this way FilOzone/synapse-sdk#899

async function waitForDataSet(synapse, dataSetId) {
let lastCount = 0
for (let attempt = 1; attempt <= 15; attempt++) {
const dataSets = await synapse.storage.findDataSets()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could replace this with one of a few different synapse-core variants that avoid having to do as much work as this does, the easiest might just be getDataSet from '@filoz/synapse-core/warm-storage' (there's also getClientDataSets which findDataSets uses to get hte list). For a singular you should get a non-null response when it exists, just give it the dataSetId you want.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice, let me have a look at these two. Thanks for the tip.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is nice to have but I can see this being broken apart over time to eventually replace example-storage-e2e.js; or perhaps just moving that into here, so we'll end up thinking about how to organise these files, maybe in their own directory.

Also, we can just write this in TypeScript and run it directly since that should work with modern Node.js. You get the proper typing free.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, sure, let's do ts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✔️ Approved by reviewer

Development

Successfully merging this pull request may close these issues.

4 participants