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

ci: use fdp-play #908

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [18.x]

steps:
- name: Checkout
Expand All @@ -36,11 +36,10 @@ jobs:
cache: 'npm'

- name: Install npm deps
run: npm install -g npm && npm ci && npm install -g @ethersphere/bee-factory
run: npm install -g npm && npm ci && npm install -g @fairdatasociety/fdp-play

# Start Bee Factory environment
- name: Start Bee Factory environment
run: npm run bee -- --verbose --detach
- name: Start fdp-play environment
run: npm run bee

- name: Tests
run: npm run test
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"lint": "eslint --fix \"src/**/*.ts\" \"test/**/*.ts\" && prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"lint:check": "eslint \"src/**/*.ts\" \"test/**/*.ts\" && prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
"depcheck": "depcheck .",
"bee": "npx bee-factory start"
"bee": "npx fdp-play start --detach --fresh"
},
"dependencies": {
"@ethersphere/swarm-cid": "^0.1.0",
Expand Down Expand Up @@ -129,6 +129,6 @@
"npm": ">=6.0.0",
"beeApiVersion": "4.0.0",
"beeDebugApiVersion": "4.0.0",
"bee": "1.13.0-f1067884"
"bee": "1.18.2-759f56f"
}
}
2 changes: 1 addition & 1 deletion src/modules/debug/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Following lines bellow are automatically updated with GitHub Action when Bee version is updated
// so if you are changing anything about them change the `update_bee` action accordingly!
export const SUPPORTED_BEE_VERSION_EXACT = '1.13.0-f1067884'
export const SUPPORTED_BEE_VERSION_EXACT = '1.18.2-759f56f'
export const SUPPORTED_API_VERSION = '4.0.0'
export const SUPPORTED_DEBUG_API_VERSION = '4.0.0'

Expand Down Expand Up @@ -83,7 +83,7 @@
* @returns true if the Bee node version is supported
* @deprecated Use `isSupportedExactVersion` instead
*/
// TODO: Remove on break

Check warning on line 86 in src/modules/debug/status.ts

View workflow job for this annotation

GitHub Actions / check (16.x)

Unexpected 'todo' comment: 'TODO: Remove on break'
export async function isSupportedVersion(requestOptions: BeeRequestOptions): Promise<boolean> {
return isSupportedExactVersion(requestOptions)
}
Expand Down
31 changes: 6 additions & 25 deletions src/utils/type.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { decodeCid, encodeReference, ReferenceType } from '@ethersphere/swarm-cid'
import {
Address,
AddressPrefix,
ADDRESS_HEX_LENGTH,
AddressPrefix,
AllTagsOptions,
BatchId,
BATCH_ID_HEX_LENGTH,
BatchId,
BeeRequestOptions,
CashoutOptions,
CollectionUploadOptions,
ENCRYPTED_REFERENCE_HEX_LENGTH,
FileUploadOptions,
NumberString,
PostageBatchOptions,
PssMessageHandler,
PSS_TARGET_HEX_LENGTH_MAX,
PssMessageHandler,
PUBKEY_HEX_LENGTH,
PublicKey,
Readable,
Reference,
ReferenceOrEns,
REFERENCE_HEX_LENGTH,
ReferenceOrEns,
Tag,
TAGS_LIMIT_MAX,
TAGS_LIMIT_MIN,
Expand Down Expand Up @@ -51,17 +51,7 @@
return value !== null && typeof value === 'object'
}

/**
* Generally it is discouraged to use `object` type, but in this case I think
* it is best to do so as it is possible to easily convert from `object`to other
* types, which will be usually the case after asserting that the object is
* strictly object. With for example Record<string, unknown> you have to first
* cast it to `unknown` which I think bit defeat the purpose.
*
* @param value
*/
// eslint-disable-next-line @typescript-eslint/ban-types
export function isStrictlyObject(value: unknown): value is object {
export function isStrictlyObject(value: unknown): value is Record<string, unknown> {
return isObject(value) && !Array.isArray(value)
}

Expand Down Expand Up @@ -301,16 +291,7 @@
return false
}

const tag = value as Record<string, unknown>

const numberProperties = ['total', 'processed', 'synced', 'uid']
const correctNumberProperties = numberProperties.every(numberProperty => typeof tag[numberProperty] === 'number')

if (!correctNumberProperties || !tag.startedAt || typeof tag.startedAt !== 'string') {
return false
}

return true
return !!value.uid

Check failure on line 294 in src/utils/type.ts

View workflow job for this annotation

GitHub Actions / check (16.x)

use `Boolean(value.uid)` instead
}

export function assertTag(value: unknown): asserts value is Tag {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/modules/bzz.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe('modules/bzz', () => {

// Relates to how many chunks is uploaded which depends on manifest serialization.
// https://github.com/ethersphere/bee/pull/1501#discussion_r611385602
const EXPECTED_TAGS_COUNT = 6
const EXPECTED_TAGS_COUNT = 2

const data = randomByteArray(5000, 2)
const filename = 'hello.txt'
Expand Down
18 changes: 9 additions & 9 deletions test/integration/modules/pinning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ describe('modules/pin', () => {
it('should not pin a non-existing file', async function () {
this.timeout(ERR_TIMEOUT)

await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should not unpin a non-existing file', async function () {
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})
})

Expand Down Expand Up @@ -68,11 +68,11 @@ describe('modules/pin', () => {
it('should not pin a non-existing collections', async function () {
this.timeout(ERR_TIMEOUT)

await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should not unpin a non-existing collections', async function () {
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})
})

Expand All @@ -92,11 +92,11 @@ describe('modules/pin', () => {
it('should not pin a non-existing data', async function () {
this.timeout(ERR_TIMEOUT)

await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should not unpin a non-existing data', async function () {
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})
})

Expand All @@ -118,11 +118,11 @@ describe('modules/pin', () => {
it('should not pin a non-existing chunk', async function () {
this.timeout(ERR_TIMEOUT)

await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.pin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should not unpin a non-existing chunk', async function () {
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.unpin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should return pinning status of existing chunk', async function () {
Expand All @@ -135,7 +135,7 @@ describe('modules/pin', () => {
})

it('should not return pinning status of non-existing chunk', async function () {
await expect(pinning.getPin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 404')
await expect(pinning.getPin(BEE_KY_OPTIONS, invalidReference)).rejectedWith('Request failed with status code 500')
})

it('should return list of pinned chunks', async function () {
Expand Down
19 changes: 13 additions & 6 deletions test/integration/modules/tag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ describe('modules/tag', () => {
jestExpect(tags).toEqual(
jestExpect.arrayContaining([
jestExpect.objectContaining({
total: jestExpect.any(Number),
processed: jestExpect.any(Number),
address: jestExpect.any(String),
seen: jestExpect.any(Number),
sent: jestExpect.any(Number),
split: jestExpect.any(Number),
startedAt: jestExpect.any(String),
stored: jestExpect.any(Number),
synced: jestExpect.any(Number),
uid: jestExpect.any(Number),
startedAt: jestExpect.any(String),
}),
]),
)
Expand All @@ -31,6 +34,7 @@ describe('modules/tag', () => {
expect(tag1.split).to.eql(0)
expect(tag1.sent).to.eql(0)
expect(tag1.synced).to.eql(0)
expect(tag1.stored).to.eql(0)
expect(Number.isInteger(tag1.uid)).to.be.ok()
expect(tag1.startedAt).a('string')
})
Expand All @@ -42,11 +46,14 @@ describe('modules/tag', () => {
expect(tag1).to.eql(tag2)
jestExpect(tag1).toEqual(
jestExpect.objectContaining({
total: jestExpect.any(Number),
processed: jestExpect.any(Number),
address: jestExpect.any(String),
seen: jestExpect.any(Number),
sent: jestExpect.any(Number),
split: jestExpect.any(Number),
startedAt: jestExpect.any(String),
stored: jestExpect.any(Number),
synced: jestExpect.any(Number),
uid: jestExpect.any(Number),
startedAt: jestExpect.any(String),
}),
)
})
Expand Down
Loading