diff --git a/.github/workflows/grid_client_nightly.yml b/.github/workflows/grid_client_nightly.yml index c6f40644d9..df1efe0406 100644 --- a/.github/workflows/grid_client_nightly.yml +++ b/.github/workflows/grid_client_nightly.yml @@ -26,11 +26,11 @@ jobs: - uses: actions/checkout@v4 if: ${{ env.NETWORK == 'qa' }} with: - ref: refs/tags/v2.4.3 + ref: refs/tags/v2.5.0-rc2 - uses: actions/checkout@v4 if: ${{ env.NETWORK == 'test' }} with: - ref: refs/tags/v2.4.3 + ref: refs/tags/v2.5.0-rc2 - uses: actions/checkout@v4 if: ${{ env.NETWORK == 'main' }} with: @@ -134,7 +134,12 @@ jobs: steps.deleteall.outcome != 'success' run: exit 1 + - name: Get the day of the week + id: dayofweek + run: echo "DAY_OF_WEEK=$(date +%u)" >> $GITHUB_ENV + - name: Create GitHub Issue on Failure + if: needs.teststatus.result == 'failure' && env.DAY_OF_WEEK != '5' && env.DAY_OF_WEEK != '6' uses: dacbd/create-issue-action@main with: token: ${{ github.token }} @@ -151,7 +156,6 @@ jobs: - Commit: ${{ github.sha }} - Network: `${{ env.NETWORK }}` - Dynamic Single Vm: ${{ steps.dynamicsinglevm.outcome }} Multiple Vm: ${{ steps.multiplevm.outcome }} Kubernetes: ${{ steps.kubernetes.outcome }} @@ -160,5 +164,4 @@ jobs: Kvstore: ${{ steps.kvstore.outcome }} Zdb: ${{ steps.zdb.outcome }} Delete all contracts: ${{ steps.deleteall.outcome }} - labels: type_bug , grid_client - + labels: type_bug, grid_client diff --git a/packages/grid_client/tests/modules/compute_capacity.test.ts b/packages/grid_client/tests/modules/compute_capacity.test.ts new file mode 100644 index 0000000000..08c0de91b9 --- /dev/null +++ b/packages/grid_client/tests/modules/compute_capacity.test.ts @@ -0,0 +1,66 @@ +import { ComputeCapacity } from "../../src"; + +let computeCapacity: ComputeCapacity; + +beforeEach(() => { + computeCapacity = new ComputeCapacity(); +}); +describe("Compute Capacity module", () => { + test("Compute Capacity instance is of type ComputeCapacity.", () => { + expect(computeCapacity).toBeInstanceOf(ComputeCapacity); + }); + + test("Min values for cpu & memory.", () => { + const cpu = 0; + const mem = 255 * 1024 ** 2; + + computeCapacity.cpu = cpu; + computeCapacity.memory = mem; + + const result = () => computeCapacity.challenge(); + + expect(result).toThrow(); + }); + + test("Max values for cpu & memory.", () => { + const cpu = 33; + const mem = 255 * 1024 ** 4; + + computeCapacity.cpu = cpu; + computeCapacity.memory = mem; + + const result = () => computeCapacity.challenge(); + + expect(result).toThrow(); + }); + + test("cpu & memory doesn't accept decimal values.", () => { + const cpu = 1.5; + const mem = 1.2; + + computeCapacity.cpu = cpu; + computeCapacity.memory = mem; + + const result = () => computeCapacity.challenge(); + + expect(result).toThrow(); + }); + + test("cpu & memory empty values.", () => { + const result = () => computeCapacity.challenge(); + + expect(result).toThrow(); + }); + + test("An error should be thrown if cpu & memory negative values.", () => { + const negative_cpu = -1; + const negative_mem = -1; + + computeCapacity.cpu = negative_cpu; + computeCapacity.memory = negative_mem; + + const result = () => computeCapacity.challenge(); + + expect(result).toThrow(); + }); +}); diff --git a/packages/playground/src/components/contracts_list/contracts_table.vue b/packages/playground/src/components/contracts_list/contracts_table.vue index b672823eb0..322f301645 100644 --- a/packages/playground/src/components/contracts_list/contracts_table.vue +++ b/packages/playground/src/components/contracts_list/contracts_table.vue @@ -167,7 +167,7 @@ above. - + Close {{ c.contract_id }} - + Cancel @@ -149,26 +149,28 @@ export default { farmId: enableCustomDomain.value ? props.farm?.farmId : undefined, availableFor: gridStore.client.twinId, })); + const selectedDomain = ref(null); + const loadDomains = () => domainsTask.value.run(gridStore, filters.value); + + const reloadDomains = async (_filters: FilterOptions = filters.value) => { + if (selectedDomain.value) { + selectedDomain.value = null; + bindModelValue(); + bindStatus(); + } + await pageCountTask.value.run(gridStore, _filters); + pagination.value.reset(pageCountTask.value.data as number); + await nextTick(); + loadedDomains.value = []; + return loadDomains(); + }; - const reloadDomains = () => domainsTask.value.run(gridStore, filters.value); - - useWatchDeep( - filters, - async filters => { - await pageCountTask.value.run(gridStore, filters); - pagination.value.reset(pageCountTask.value.data as number); - await nextTick(); - loadedDomains.value = []; - return reloadDomains(); - }, - { - immediate: true, - deep: true, - ignoreFields: ["page"], - }, - ); + useWatchDeep(filters, reloadDomains, { + immediate: true, + deep: true, + ignoreFields: ["page"], + }); const customDomain = ref(""); - const selectedDomain = ref(null); const domainNameValid = ref(null); watch(domainNameValid, valid => { @@ -235,6 +237,7 @@ export default { domainsTask, loadedDomains, selectedDomain, + loadDomains, reloadDomains, disableSelectedDomain, diff --git a/packages/playground/src/views/nodes.vue b/packages/playground/src/views/nodes.vue index 086f6faa7c..fed472adc3 100644 --- a/packages/playground/src/views/nodes.vue +++ b/packages/playground/src/views/nodes.vue @@ -571,8 +571,7 @@ export default { sortBy: SortBy.Status, sortOrder: SortOrder.Asc, numGpu: +filters.value.numGpu || undefined, - rentable: filters.value.rentable && profileManager.profile ? filters.value.rentable : undefined, - availableFor: filters.value.rentable && profileManager.profile ? profileManager.profile.twinId : undefined, + rentable: filters.value.rentable ? filters.value.rentable : undefined, hasIPv6: filters.value.ipv6 ? filters.value.ipv6 : undefined, rentedBy: filters.value.mine && profileManager.profile ? profileManager.profile.twinId : undefined, }, diff --git a/packages/playground/src/weblets/tf_contracts_list.vue b/packages/playground/src/weblets/tf_contracts_list.vue index 93bed0b70a..d2d41dfd6b 100644 --- a/packages/playground/src/weblets/tf_contracts_list.vue +++ b/packages/playground/src/weblets/tf_contracts_list.vue @@ -119,6 +119,7 @@ color="warning" @click="unlockAllContracts" :loading="unlockContractLoading" + class="ml-2" > Unlock contracts @@ -336,7 +337,7 @@ async function loadContracts(type?: ContractType, options?: { sort: { key: strin loadContractsByType(ContractType.Rent, rentContracts, options), ]); } - + await getContractsLockDetails(); contracts.value = [...nodeContracts.value, ...nameContracts.value, ...rentContracts.value]; // Update the total cost of the contracts.