Skip to content

Commit

Permalink
chore: Remove unused Ceramic nodes from test
Browse files Browse the repository at this point in the history
  • Loading branch information
stbrody committed Feb 22, 2024
1 parent ff035d5 commit 947a6c5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 64 deletions.
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
55 changes: 6 additions & 49 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 Down Expand Up @@ -320,8 +301,6 @@ describe('Ceramic Integration Test', () => {
ipfs2.stop(),
ipfs3.stop(),
ipfs4.stop(),
ipfs5.stop(),
ipfs6.stop(),
])
await ganacheServer.close()
await anchorLauncher.stop()
Expand All @@ -332,15 +311,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 +328,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 @@ -392,7 +351,6 @@ describe('Ceramic Integration Test', () => {
cas1.stop()
cas2.stop()
await Promise.all([dbConnection1.destroy(), dbConnection2.destroy()])
await Promise.all([daemon1.close(), daemon2.close()])
await Promise.all([
casCeramic1.close(),
casCeramic2.close(),
Expand Down Expand Up @@ -565,7 +523,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

0 comments on commit 947a6c5

Please sign in to comment.