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

chore: Remove unused Ceramic nodes from test #1186

Merged
merged 2 commits into from
Feb 23, 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
4 changes: 0 additions & 4 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"timeout": 120000,
"concurrentGetLimit": 100
},
"ceramic": {
"apiUrl": "http://localhost:7007",
"validateRecords": false
},
"blockchain": {
"selectedConnector": "ethereum",
"connectors": {
Expand Down
4 changes: 0 additions & 4 deletions config/env/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"timeout": "@@IPFS_API_TIMEOUT",
"concurrentGetLimit": "@@IPFS_CONCURRENT_GET_LIMIT"
},
"ceramic": {
"apiUrl": "@@CERAMIC_API_URL",
"validateRecords": "@@VALIDATE_RECORDS"
},
"blockchain": {
"selectedConnector": "@@BLOCKCHAIN_CONNECTOR",
"connectors": {
Expand Down
4 changes: 0 additions & 4 deletions config/env/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
"timeout": "@@IPFS_API_TIMEOUT",
"concurrentGetLimit": "@@IPFS_CONCURRENT_GET_LIMIT"
},
"ceramic": {
"apiUrl": "@@CERAMIC_API_URL",
"validateRecords": "@@VALIDATE_RECORDS"
},
"blockchain": {
"selectedConnector": "@@BLOCKCHAIN_CONNECTOR",
"connectors": {
Expand Down
3 changes: 0 additions & 3 deletions config/env/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"mode": "s3",
"s3BucketName": "ceramic-tnet-cas"
},
"ceramic": {
"validateRecords": false
},
"blockchain": {
"selectedConnector": "ethereum",
"connectors": {
Expand Down
73 changes: 10 additions & 63 deletions src/__tests__/ceramic_integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ function makeAnchorLauncher(port: number): FauxAnchorLauncher {

interface MinimalCASConfig {
ipfsPort: number
ceramicPort: number
ganachePort: number
mode: string
port: number
Expand All @@ -194,7 +193,6 @@ async function makeCAS(
configCopy.minStreamCount = 1
configCopy.ipfsConfig.url = `http://localhost:${minConfig.ipfsPort}`
configCopy.ipfsConfig.pubsubTopic = TOPIC
configCopy.ceramic.apiUrl = `http://localhost:${minConfig.ceramicPort}`
configCopy.blockchain.connectors.ethereum.network = 'ganache'
configCopy.blockchain.connectors.ethereum.rpc.port = String(minConfig.ganachePort)
configCopy.useSmartContractAnchors = minConfig.useSmartContractAnchors
Expand Down Expand Up @@ -245,22 +243,12 @@ describe('Ceramic Integration Test', () => {

let ipfs1: IpfsApi // Used by CAS1 directly
let ipfs2: IpfsApi // Used by CAS2 directly
let ipfs3: IpfsApi // Used by CAS1 ceramic
let ipfs4: IpfsApi // Used by CAS2 ceramic
let ipfs5: IpfsApi // Used by main ceramic 1
let ipfs6: IpfsApi // Used by main ceramic 2
let ipfs3: IpfsApi // Used by main ceramic 1
let ipfs4: IpfsApi // Used by main ceramic 2

// let ipfsServer1: HttpApi
// let ipfsServer2: HttpApi

let casCeramic1: Ceramic // Ceramic node used internally by CAS1
let casCeramic2: Ceramic // Ceramic node used internally by CAS2
let ceramic1: Ceramic // First main Ceramic node used by the tests
let ceramic2: Ceramic // Second main Ceramic node used by the tests

let daemon1: CeramicDaemon // CAS1 Ceramic http server
let daemon2: CeramicDaemon // CAS2 Ceramic http server

let dbConnection1: Knex
let dbConnection2: Knex

Expand All @@ -276,22 +264,15 @@ describe('Ceramic Integration Test', () => {
beforeAll(async () => {
ipfsApiPort1 = await getPort()
ipfsApiPort2 = await getPort()
;[ipfs1, ipfs2, ipfs3, ipfs4, ipfs5, ipfs6] = await Promise.all([
;[ipfs1, ipfs2, ipfs3, ipfs4] = await Promise.all([
createIPFS(ipfsApiPort1),
createIPFS(ipfsApiPort2),
createIPFS(),
createIPFS(),
createIPFS(),
createIPFS(),
])

// ipfsServer1 = new HttpApi(ipfs1)
// await ipfsServer1.start()
// ipfsServer2 = new HttpApi(ipfs2)
// await ipfsServer2.start()

// Now make sure all ipfs nodes are connected to all other ipfs nodes
const ipfsNodes = [ipfs1, ipfs2, ipfs3, ipfs4, ipfs5, ipfs6]
const ipfsNodes = [ipfs1, ipfs2, ipfs3, ipfs4]
for (const [i] of ipfsNodes.entries()) {
for (const [j] of ipfsNodes.entries()) {
if (i == j) {
Expand All @@ -315,14 +296,7 @@ describe('Ceramic Integration Test', () => {

afterAll(async () => {
// await Promise.all([ipfsServer1.stop(), ipfsServer2.stop()])
await Promise.all([
ipfs1.stop(),
ipfs2.stop(),
ipfs3.stop(),
ipfs4.stop(),
ipfs5.stop(),
ipfs6.stop(),
])
await Promise.all([ipfs1.stop(), ipfs2.stop(), ipfs3.stop(), ipfs4.stop()])
await ganacheServer.close()
await anchorLauncher.stop()
})
Expand All @@ -332,15 +306,12 @@ describe('Ceramic Integration Test', () => {
const useSmartContractAnchors = true

// Start anchor services
const daemonPort1 = await getPort()
const daemonPort2 = await getPort()
dbConnection1 = await createDbConnection()
casPort1 = await getPort()

cas1 = await makeCAS(createInjector(), dbConnection1, {
mode: 'server',
ipfsPort: ipfsApiPort1,
ceramicPort: daemonPort1,
ganachePort: ganacheServer.port,
port: casPort1,
useSmartContractAnchors,
Expand All @@ -352,33 +323,16 @@ describe('Ceramic Integration Test', () => {
cas2 = await makeCAS(createInjector(), dbConnection2, {
mode: 'server',
ipfsPort: ipfsApiPort2,
ceramicPort: daemonPort2,
ganachePort: ganacheServer.port,
port: casPort2,
useSmartContractAnchors,
})
await cas2.start()
anchorService2 = cas2.container.resolve('anchorService')

// Make the Ceramic nodes that will be used by the CAS.
;[casCeramic1, casCeramic2] = await Promise.all([
makeCeramicCore(ipfs3, `http://localhost:${casPort1}`, ganacheServer.url),
makeCeramicCore(ipfs4, `http://localhost:${casPort2}`, ganacheServer.url),
])
daemon1 = new CeramicDaemon(
casCeramic1,
DaemonConfig.fromObject({ 'http-api': { port: daemonPort1 } })
)
daemon2 = new CeramicDaemon(
casCeramic1,
DaemonConfig.fromObject({ 'http-api': { port: daemonPort2 } })
)
await daemon1.listen()
await daemon2.listen()

// Finally make the Ceramic nodes that will be used in the tests.
ceramic1 = await makeCeramicCore(ipfs5, `http://localhost:${casPort1}`, ganacheServer.url)
ceramic2 = await makeCeramicCore(ipfs6, `http://localhost:${casPort2}`, ganacheServer.url)
ceramic1 = await makeCeramicCore(ipfs3, `http://localhost:${casPort1}`, ganacheServer.url)
ceramic2 = await makeCeramicCore(ipfs4, `http://localhost:${casPort2}`, ganacheServer.url)

// The two user-facing ceramic nodes need to have the same DID Provider so that they can modify
// each others streams.
Expand All @@ -389,16 +343,10 @@ describe('Ceramic Integration Test', () => {
})

afterAll(async () => {
cas1.stop()
cas2.stop()
await cas1.stop()
await cas2.stop()
await Promise.all([dbConnection1.destroy(), dbConnection2.destroy()])
await Promise.all([daemon1.close(), daemon2.close()])
await Promise.all([
casCeramic1.close(),
casCeramic2.close(),
ceramic1.close(),
ceramic2.close(),
])
await Promise.all([ceramic1.close(), ceramic2.close()])
})

beforeEach(async () => {
Expand Down Expand Up @@ -565,7 +513,6 @@ describe('CAR file', () => {
const cas = await makeCAS(createInjector(), dbConnection, {
mode: 'server',
ipfsPort: ipfsApiPort,
ceramicPort: await getPort(),
ganachePort: ganacheServer.port,
port: casPort,
useSmartContractAnchors: true,
Expand Down
Loading