storj/web/storagenode/tests/unit/components/DiskStatChart.spec.ts
Clement Sam 59b37db670 storagenode: overhaul QUIC check implementation
The current implementation blocks the the startup until one or none
of the trusted satellites is able to reach the node via QUIC.
This can cause delayed startup. Also, the quic check is done
once during startup, and if there is a misconfiguration later,
snos would have to restart to node.

In this change, we reuse the contact service which pings the satellite
periodically for node checkin. During checkin the satellite tries
pinging the node back via both TCP and QUIC and reports both statuses.
WIth this, we are able to get a periodic update of the QUIC status
without restarting the node.

Also adds the time the node was last pinged via QUIC to the tooltip
on the QUIC status tab.

Resolves https://github.com/storj/storj/issues/4398

Change-Id: I18aa2a8e8d44e8187f8f2eb51f398fa6073882a4
2022-11-09 03:15:57 +00:00

73 lines
2.3 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { newNodeModule, NODE_ACTIONS, QUIC_STATUS } from '@/app/store/modules/node';
import { Size } from '@/private/memory/size';
import { StorageNodeApi } from '@/storagenode/api/storagenode';
import { StorageNodeService } from '@/storagenode/sno/service';
import { Dashboard, SatelliteInfo, Traffic } from '@/storagenode/sno/sno';
import DiskStatChart from '@/app/components/DiskStatChart.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
localVue.filter('bytesToBase10String', (amountInBytes: number): string => {
return `${Size.toBase10String(amountInBytes)}`;
});
const nodeApi = new StorageNodeApi();
const nodeService = new StorageNodeService(nodeApi);
const nodeModule = newNodeModule(nodeService);
const store = new Vuex.Store({ modules: { node: nodeModule } });
describe('DiskStatChart', (): void => {
it('renders correctly', (): void => {
const wrapper = shallowMount(DiskStatChart, {
store,
localVue,
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with actual values', async (): Promise<void> => {
const wrapper = shallowMount(DiskStatChart, {
store,
localVue,
});
jest.spyOn(nodeApi, 'dashboard').mockReturnValue(
Promise.resolve(
new Dashboard(
'1',
'2',
[],
[
new SatelliteInfo('3', 'url1', null, null),
new SatelliteInfo('4', 'url2', new Date(2020, 1, 1), new Date(2020, 0, 1)),
],
new Traffic(550000, 1000000, 22000, 11000),
new Traffic(50),
new Date(),
new Date(2019, 3, 1),
'0.1.1',
'0.2.2',
false,
QUIC_STATUS.StatusOk,
'13000',
new Date(2022, 11, 8),
),
),
);
await store.dispatch(NODE_ACTIONS.GET_NODE_INFO);
expect(wrapper).toMatchSnapshot();
});
});