Skip to content

Commit

Permalink
fix: enable last shard tests (#4)
Browse files Browse the repository at this point in the history
Fixes up traversing deep shards
  • Loading branch information
achingbrain committed Feb 25, 2023
1 parent 9d4799b commit 9774460
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/commands/utils/hamt-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const recreateInitialHamtLevel = async (links: PBLink[]): Promise<Bucket<
}, bucket, pos)

bucket._putObjectAt(pos, subBucket)
return
}

await bucket.put(linkName.substring(2), {
Expand Down Expand Up @@ -126,6 +127,7 @@ export const addLinksToHamtBucket = async (blockstore: Blockstore, links: PBLink
bucket._putObjectAt(pos, subBucket)

await addLinksToHamtBucket(blockstore, node.Links, subBucket, rootBucket, options)
return
}

await rootBucket.put(linkName.substring(2), {
Expand Down Expand Up @@ -218,7 +220,7 @@ export const generatePath = async (root: Directory, name: string, blockstore: Bl
// found subshard
log(`Found subshard ${segment.prefix}`)
const block = await blockstore.get(link.Hash)
const node = dagPB.decode(block)
const node = segment.node = dagPB.decode(block)

// subshard hasn't been loaded, descend to the next level of the HAMT
if (path[i + 1] == null) {
Expand Down Expand Up @@ -247,8 +249,6 @@ export const generatePath = async (root: Directory, name: string, blockstore: Bl

// add intermediate links to bucket
await addLinksToHamtBucket(blockstore, node.Links, segment.bucket, rootBucket, options)

segment.node = node
}

await rootBucket.put(name, true)
Expand Down
4 changes: 2 additions & 2 deletions test/rm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe('rm', () => {
expect(containingDirCid).to.eql(importerCid)
})

it.skip('results in the same hash as a sharded directory created by the importer when removing a subshard', async function () {
it('results in the same hash as a sharded directory created by the importer when removing a subshard', async function () {
let {
containingDirCid,
fileName,
Expand All @@ -195,7 +195,7 @@ describe('rm', () => {
expect(containingDirCid).to.eql(importerCid)
})

it.skip('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
it('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
let {
containingDirCid,
fileName,
Expand Down

0 comments on commit 9774460

Please sign in to comment.