Browse Source

tests - active video counters improvements VI

ondratra 3 years ago
parent
commit
88b058fffd

+ 3 - 1
query-node/run-tests.sh

@@ -25,5 +25,7 @@ docker-compose up -d joystream-node
 
 ./start.sh
 
+../tests/network-tests/start-storage.sh
+
 # run content directory tests
-yarn workspace network-tests run-test-scenario content-directory
+REUSE_KEYS=true yarn workspace network-tests run-test-scenario content-directory

+ 2 - 22
tests/network-tests/run-full-tests.sh

@@ -18,31 +18,11 @@ sleep 3
 # Display runtime version
 yarn workspace api-scripts tsnode-strict src/status.ts | grep Runtime
 
-# Start any other services we want
-# docker-compose -f ../../docker-compose.yml up -d colossus-1
-
 # Start a query-node
 ../../query-node/start.sh
 
-# Run proposals tests first, since they require no leads hired
-./run-test-scenario.sh proposals
-
-# Setup storage & distribution
-HOST_IP=$(./get-host-ip.sh)
-# Because proposals tests hire and then fire each lead,
-# we need to override COLOSSUS_1_WORKER_ID (0 => 1) and DISTRIBUTOR_1_WORKER_ID (0 => 1)
-export COLOSSUS_1_URL="http://${HOST_IP}:3333"
-export COLOSSUS_1_WORKER_ID=1
-export COLOSSUS_1_WORKER_URI=//testing//worker//Storage//${COLOSSUS_1_WORKER_ID}
-export COLOSSUS_1_TRANSACTOR_KEY=$(docker run --rm --pull=always docker.io/parity/subkey:2.0.1 inspect ${COLOSSUS_1_TRANSACTOR_URI} --output-type json | jq .ss58Address -r)
-export DISTRIBUTOR_1_URL="http://${HOST_IP}:3334"
-export DISTRIBUTOR_1_WORKER_ID=1
-export DISTRIBUTOR_1_ACCOUNT_URI=//testing//worker//Distribution//${DISTRIBUTOR_1_WORKER_ID}
-REUSE_KEYS=true ./run-test-scenario.sh init-storage-and-distribution
-
-# Start colossus & argus
-docker-compose -f ../../docker-compose.yml up -d colossus-1
-docker-compose -f ../../docker-compose.yml up -d distributor-1
+# Start storage and distribution services
+./start-storage.sh
 
 # Run combined tests reusing the existing keys
 REUSE_KEYS=true ./run-test-scenario.sh combined

+ 0 - 51
tests/network-tests/src/fixtures/content/createChannelsAndVideos.ts

@@ -83,19 +83,6 @@ export class CreateChannelsAndVideosFixture extends BaseQueryNodeFixture {
       this.createdItems.channelIds[0],
       this.videoCategoryId
     )
-
-    const { storageBucketId, storageGroupWorkerId, storageGroupWorkerAccount } = await this.retrieveBucket()
-
-    this.debug('Accepting content to storage bag')
-    const allAssetIds = this.createdItems.videosData.map((item) => item.assetContentIds).flat()
-    await this.api.acceptPendingDataObjects(
-      // storageGroupWorker.keyringPair.address,
-      storageGroupWorkerAccount,
-      storageGroupWorkerId,
-      storageBucketId,
-      this.createdItems.channelIds[0].toString(),
-      allAssetIds
-    )
   }
 
   /**
@@ -137,44 +124,6 @@ export class CreateChannelsAndVideosFixture extends BaseQueryNodeFixture {
     }))
   }
 
-  /**
-    Retrieves storage bucket info.
-  */
-  private async retrieveBucket(): Promise<{
-    storageBucketId: StorageBucketId
-    storageGroupWorkerId: WorkerId
-    storageGroupWorkerAccount: string
-  }> {
-    // read existing storage buckets from runtime
-    const bucketEntries = await this.api.query.storage.storageBucketById.entries()
-
-    // create WorkerId object
-    const storageGroupWorkerId = createType('WorkerId', singleBucketConfig.buckets[0].operatorId)
-
-    // find some bucket created by worker
-    const bucketTuple = bucketEntries.find(
-      ([, /* storageBucketId */ storageBucket]) =>
-        (storageBucket.operator_status as any).isStorageWorker &&
-        (storageBucket.operator_status as any).asStorageWorker[0].toString() === storageGroupWorkerId.toString()
-    )
-    if (!bucketTuple) {
-      throw new Error('Storage bucket not initialized')
-    }
-
-    // retrieve worker address
-    const storageGroupWorkerAccount = this.api.createCustomKeyPair(singleBucketConfig.buckets[0].transactorUri, true)
-      .address
-
-    // create StorageBucketId object
-    const storageBucketId = createType('StorageBucketId', bucketTuple[0].args[0])
-
-    return {
-      storageBucketId,
-      storageGroupWorkerId,
-      storageGroupWorkerAccount,
-    }
-  }
-
   /**
     Creates a new channel.
   */

+ 3 - 3
tests/network-tests/src/scenarios/combined.ts

@@ -37,10 +37,10 @@ scenario('Combined', async ({ job }) => {
     manageWorkerAsWorker.distribution,
   ]).requires(leadSetupJob)
 
+  const createChannelJob = job('create channel via CLI', createChannel).requires(leadSetupJob)
+
   const initBucketsJob = job('init storage and distribution buckets via CLI', [
     initDistributionBucket,
     initStorageBucket,
-  ]).requires(leadSetupJob)
-
-  const createChannelJob = job('create channel via CLI', createChannel).requires(initBucketsJob)
+  ]).requires(createChannelJob)
 })

+ 1 - 5
tests/network-tests/src/scenarios/content-directory.ts

@@ -8,10 +8,6 @@ import { scenario } from '../Scenario'
 scenario('Content directory', async ({ job }) => {
   const leadSetupJob = job('setup working group leads', [
     leaderSetup(WorkingGroups.Content, true),
-    leaderSetup(WorkingGroups.Storage, true),
   ])
-
-  const initStorageJob = job('initialize storage system', initStorage(storageConfig)).requires(leadSetupJob)
-
-  job('check active video counters', activeVideoCounters).requires(initStorageJob)
+  job('check active video counters', activeVideoCounters).requires(leadSetupJob)
 })

+ 22 - 0
tests/network-tests/start-storage.sh

@@ -0,0 +1,22 @@
+TMP=$0
+THIS_DIR=`dirname $TMP`
+
+# Run proposals tests first, since they require no leads hired
+$THIS_DIR/run-test-scenario.sh proposals
+
+# Setup storage & distribution
+HOST_IP=`$THIS_DIR/get-host-ip.sh`
+# Because proposals tests hire and then fire each lead,
+# we need to override COLOSSUS_1_WORKER_ID (0 => 1) and DISTRIBUTOR_1_WORKER_ID (0 => 1)
+export COLOSSUS_1_URL="http://${HOST_IP}:3333"
+export COLOSSUS_1_WORKER_ID=1
+export COLOSSUS_1_WORKER_URI=//testing//worker//Storage//${COLOSSUS_1_WORKER_ID}
+export COLOSSUS_1_TRANSACTOR_KEY=$(docker run --rm --pull=always docker.io/parity/subkey:2.0.1 inspect ${COLOSSUS_1_TRANSACTOR_URI} --output-type json | jq .ss58Address -r)
+export DISTRIBUTOR_1_URL="http://${HOST_IP}:3334"
+export DISTRIBUTOR_1_WORKER_ID=1
+export DISTRIBUTOR_1_ACCOUNT_URI=//testing//worker//Distribution//${DISTRIBUTOR_1_WORKER_ID}
+REUSE_KEYS=true $THIS_DIR/run-test-scenario.sh init-storage-and-distribution
+
+# Start colossus & argus
+docker-compose -f $THIS_DIR/../../docker-compose.yml up -d colossus-1
+docker-compose -f $THIS_DIR/../../docker-compose.yml up -d distributor-1