From c5ecca1e1da0af2be569adf1db2acf9221b0e8fb Mon Sep 17 00:00:00 2001 From: Cameron Ayer Date: Fri, 18 Dec 2020 14:27:28 -0500 Subject: [PATCH] web/storagenode: remove uptime columns and references Full scope: storagenode/{console,nodestats,notifications,reputation,storagenodedb}, web/storagenode These columns are deprecated. They used to be for the uptime reputation system which has been replaced by downtime tracking with audits. Change-Id: I151d6569577d89733ac97af21a1d885323522b21 --- storagenode/nodestats/service.go | 5 -- storagenode/notifications/notifications.go | 6 +- storagenode/reputation/reputation.go | 1 - storagenode/reputation/reputation_test.go | 17 ------ storagenode/storagenodedb/database.go | 55 +++++++++++++++++++ storagenode/storagenodedb/reputation.go | 34 +----------- storagenode/storagenodedb/schema.go | 25 --------- .../storagenodedb/testdata/multidbsnapshot.go | 1 + storagenode/storagenodedb/testdata/v48.go | 50 +++++++++++++++++ .../src/app/components/ChecksArea.vue | 8 +-- .../src/app/components/SNOContentFilling.vue | 27 +++------ .../components/payments/HeldHistoryArea.vue | 8 --- web/storagenode/src/app/store/modules/node.ts | 4 +- .../src/app/types/notifications.ts | 3 - web/storagenode/src/app/types/sno.ts | 2 +- .../src/storagenode/api/storagenode.ts | 28 ++-------- .../notifications/notifications.ts | 5 +- web/storagenode/src/storagenode/sno/sno.ts | 8 +-- .../notifications/SNONotification.spec.ts | 2 +- .../SNONotification.spec.ts.snap | 5 +- .../payments/EstimationPeriodDropdown.spec.ts | 5 +- .../payments/HeldHistoryArea.spec.ts | 12 +--- .../components/payments/TotalHeldArea.spec.ts | 5 +- web/storagenode/tests/unit/store/node.spec.ts | 19 +++---- .../tests/unit/store/notifications.spec.ts | 4 +- 25 files changed, 151 insertions(+), 188 deletions(-) create mode 100644 storagenode/storagenodedb/testdata/v48.go diff --git a/storagenode/nodestats/service.go b/storagenode/nodestats/service.go index 5a53b3c0f..68fdcdf31 100644 --- a/storagenode/nodestats/service.go +++ b/storagenode/nodestats/service.go @@ -74,15 +74,10 @@ func (s *Service) GetReputationStats(ctx context.Context, satelliteID storj.Node return nil, NodeStatsServiceErr.Wrap(err) } - uptime := resp.GetUptimeCheck() audit := resp.GetAuditCheck() return &reputation.Stats{ SatelliteID: satelliteID, - Uptime: reputation.Metric{ - TotalCount: uptime.GetTotalCount(), - SuccessCount: uptime.GetSuccessCount(), - }, Audit: reputation.Metric{ TotalCount: audit.GetTotalCount(), SuccessCount: audit.GetSuccessCount(), diff --git a/storagenode/notifications/notifications.go b/storagenode/notifications/notifications.go index 2fe20682a..fe393e3a4 100644 --- a/storagenode/notifications/notifications.go +++ b/storagenode/notifications/notifications.go @@ -31,12 +31,10 @@ const ( TypeCustom Type = 0 // TypeAuditCheckFailure is a notification type which describes node's audit check failure. TypeAuditCheckFailure Type = 1 - // TypeUptimeCheckFailure is a notification type which describes node's uptime check failure. - TypeUptimeCheckFailure Type = 2 // TypeDisqualification is a notification type which describes node's disqualification status. - TypeDisqualification Type = 3 + TypeDisqualification Type = 2 // TypeSuspension is a notification type which describes node's suspension status. - TypeSuspension Type = 4 + TypeSuspension Type = 3 ) // NewNotification holds notification entity info which is being received from satellite or local client. diff --git a/storagenode/reputation/reputation.go b/storagenode/reputation/reputation.go index 067643e4e..bd1fe2183 100644 --- a/storagenode/reputation/reputation.go +++ b/storagenode/reputation/reputation.go @@ -27,7 +27,6 @@ type DB interface { type Stats struct { SatelliteID storj.NodeID - Uptime Metric Audit Metric OnlineScore float64 diff --git a/storagenode/reputation/reputation_test.go b/storagenode/reputation/reputation_test.go index 1bba18d71..12a2baf89 100644 --- a/storagenode/reputation/reputation_test.go +++ b/storagenode/reputation/reputation_test.go @@ -25,13 +25,6 @@ func TestReputationDBGetInsert(t *testing.T) { stats := reputation.Stats{ SatelliteID: testrand.NodeID(), - Uptime: reputation.Metric{ - TotalCount: 1, - SuccessCount: 2, - Alpha: 3, - Beta: 4, - Score: 5, - }, Audit: reputation.Metric{ TotalCount: 6, SuccessCount: 7, @@ -70,7 +63,6 @@ func TestReputationDBGetInsert(t *testing.T) { assert.Equal(t, res.OnlineScore, stats.OnlineScore) assert.Nil(t, res.AuditHistory) - compareReputationMetric(t, &res.Uptime, &stats.Uptime) compareReputationMetric(t, &res.Audit, &stats.Audit) }) }) @@ -87,13 +79,6 @@ func TestReputationDBGetAll(t *testing.T) { rep := reputation.Stats{ SatelliteID: testrand.NodeID(), - Uptime: reputation.Metric{ - TotalCount: int64(i + 1), - SuccessCount: int64(i + 2), - Alpha: float64(i + 3), - Beta: float64(i + 4), - Score: float64(i + 5), - }, Audit: reputation.Metric{ TotalCount: int64(i + 6), SuccessCount: int64(i + 7), @@ -137,7 +122,6 @@ func TestReputationDBGetAll(t *testing.T) { assert.Equal(t, rep.OnlineScore, stats[0].OnlineScore) assert.Nil(t, rep.AuditHistory) - compareReputationMetric(t, &rep.Uptime, &stats[0].Uptime) compareReputationMetric(t, &rep.Audit, &stats[0].Audit) } } @@ -160,7 +144,6 @@ func TestReputationDBGetInsertAuditHistory(t *testing.T) { stats := reputation.Stats{ SatelliteID: testrand.NodeID(), - Uptime: reputation.Metric{}, Audit: reputation.Metric{}, AuditHistory: &pb.AuditHistory{ Score: 0.5, diff --git a/storagenode/storagenodedb/database.go b/storagenode/storagenodedb/database.go index 09bf9a3cf..19f9da9b3 100644 --- a/storagenode/storagenodedb/database.go +++ b/storagenode/storagenodedb/database.go @@ -1838,6 +1838,61 @@ func (db *DB) Migration(ctx context.Context) *migrate.Migration { `ALTER TABLE reputation ADD COLUMN audit_history BLOB`, }, }, + { + DB: &db.reputationDB.DB, + Description: "drop uptime columns", + Version: 48, + Action: migrate.Func(func(ctx context.Context, _ *zap.Logger, rdb tagsql.DB, rtx tagsql.Tx) (err error) { + _, err = rtx.Exec(ctx, ` + CREATE TABLE reputation_new ( + satellite_id BLOB NOT NULL, + audit_success_count INTEGER NOT NULL, + audit_total_count INTEGER NOT NULL, + audit_reputation_alpha REAL NOT NULL, + audit_reputation_beta REAL NOT NULL, + audit_reputation_score REAL NOT NULL, + audit_unknown_reputation_alpha REAL NOT NULL, + audit_unknown_reputation_beta REAL NOT NULL, + audit_unknown_reputation_score REAL NOT NULL, + online_score REAL NOT NULL, + audit_history BLOB, + disqualified_at TIMESTAMP, + updated_at TIMESTAMP NOT NULL, + suspended_at TIMESTAMP, + offline_suspended_at TIMESTAMP, + offline_under_review_at TIMESTAMP, + joined_at TIMESTAMP NOT NULL, + PRIMARY KEY (satellite_id) + ); + INSERT INTO reputation_new SELECT + satellite_id, + audit_success_count, + audit_total_count, + audit_reputation_alpha, + audit_reputation_beta, + audit_reputation_score, + audit_unknown_reputation_alpha, + audit_unknown_reputation_beta, + audit_unknown_reputation_score, + online_score, + audit_history, + disqualified_at, + updated_at, + suspended_at, + offline_suspended_at, + offline_under_review_at, + joined_at + FROM reputation; + DROP TABLE reputation; + ALTER TABLE reputation_new RENAME TO reputation; + `) + if err != nil { + return errs.Wrap(err) + } + + return nil + }), + }, }, } } diff --git a/storagenode/storagenodedb/reputation.go b/storagenode/storagenodedb/reputation.go index df0607673..6650e9c0a 100644 --- a/storagenode/storagenodedb/reputation.go +++ b/storagenode/storagenodedb/reputation.go @@ -32,11 +32,6 @@ func (db *reputationDB) Store(ctx context.Context, stats reputation.Stats) (err query := `INSERT OR REPLACE INTO reputation ( satellite_id, - uptime_success_count, - uptime_total_count, - uptime_reputation_alpha, - uptime_reputation_beta, - uptime_reputation_score, audit_success_count, audit_total_count, audit_reputation_alpha, @@ -53,7 +48,7 @@ func (db *reputationDB) Store(ctx context.Context, stats reputation.Stats) (err offline_under_review_at, updated_at, joined_at - ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)` + ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)` // ensure we insert utc if stats.DisqualifiedAt != nil { @@ -83,11 +78,6 @@ func (db *reputationDB) Store(ctx context.Context, stats reputation.Stats) (err _, err = db.ExecContext(ctx, query, stats.SatelliteID, - stats.Uptime.SuccessCount, - stats.Uptime.TotalCount, - stats.Uptime.Alpha, - stats.Uptime.Beta, - stats.Uptime.Score, stats.Audit.SuccessCount, stats.Audit.TotalCount, stats.Audit.Alpha, @@ -118,12 +108,7 @@ func (db *reputationDB) Get(ctx context.Context, satelliteID storj.NodeID) (_ *r } row := db.QueryRowContext(ctx, - `SELECT uptime_success_count, - uptime_total_count, - uptime_reputation_alpha, - uptime_reputation_beta, - uptime_reputation_score, - audit_success_count, + `SELECT audit_success_count, audit_total_count, audit_reputation_alpha, audit_reputation_beta, @@ -145,11 +130,6 @@ func (db *reputationDB) Get(ctx context.Context, satelliteID storj.NodeID) (_ *r var auditHistoryBytes []byte err = row.Scan( - &stats.Uptime.SuccessCount, - &stats.Uptime.TotalCount, - &stats.Uptime.Alpha, - &stats.Uptime.Beta, - &stats.Uptime.Score, &stats.Audit.SuccessCount, &stats.Audit.TotalCount, &stats.Audit.Alpha, @@ -188,11 +168,6 @@ func (db *reputationDB) All(ctx context.Context) (_ []reputation.Stats, err erro defer mon.Task()(&ctx)(&err) query := `SELECT satellite_id, - uptime_success_count, - uptime_total_count, - uptime_reputation_alpha, - uptime_reputation_beta, - uptime_reputation_score, audit_success_count, audit_total_count, audit_reputation_alpha, @@ -222,11 +197,6 @@ func (db *reputationDB) All(ctx context.Context) (_ []reputation.Stats, err erro var stats reputation.Stats err := rows.Scan(&stats.SatelliteID, - &stats.Uptime.SuccessCount, - &stats.Uptime.TotalCount, - &stats.Uptime.Alpha, - &stats.Uptime.Beta, - &stats.Uptime.Score, &stats.Audit.SuccessCount, &stats.Audit.TotalCount, &stats.Audit.Alpha, diff --git a/storagenode/storagenodedb/schema.go b/storagenode/storagenodedb/schema.go index d79494878..d0e199911 100644 --- a/storagenode/storagenodedb/schema.go +++ b/storagenode/storagenodedb/schema.go @@ -606,31 +606,6 @@ func Schema() map[string]*dbschema.Schema { Type: "TIMESTAMP", IsNullable: false, }, - &dbschema.Column{ - Name: "uptime_reputation_alpha", - Type: "REAL", - IsNullable: false, - }, - &dbschema.Column{ - Name: "uptime_reputation_beta", - Type: "REAL", - IsNullable: false, - }, - &dbschema.Column{ - Name: "uptime_reputation_score", - Type: "REAL", - IsNullable: false, - }, - &dbschema.Column{ - Name: "uptime_success_count", - Type: "INTEGER", - IsNullable: false, - }, - &dbschema.Column{ - Name: "uptime_total_count", - Type: "INTEGER", - IsNullable: false, - }, }, }, }, diff --git a/storagenode/storagenodedb/testdata/multidbsnapshot.go b/storagenode/storagenodedb/testdata/multidbsnapshot.go index 7022875dd..b176d114c 100644 --- a/storagenode/storagenodedb/testdata/multidbsnapshot.go +++ b/storagenode/storagenodedb/testdata/multidbsnapshot.go @@ -62,6 +62,7 @@ var States = MultiDBStates{ &v45, &v46, &v47, + &v48, }, } diff --git a/storagenode/storagenodedb/testdata/v48.go b/storagenode/storagenodedb/testdata/v48.go new file mode 100644 index 000000000..eed69b72d --- /dev/null +++ b/storagenode/storagenodedb/testdata/v48.go @@ -0,0 +1,50 @@ +// Copyright (C) 2020 Storj Labs, Inc. +// See LICENSE for copying information. + +package testdata + +import "storj.io/storj/storagenode/storagenodedb" + +var v48 = MultiDBState{ + Version: 48, + DBStates: DBStates{ + storagenodedb.UsedSerialsDBName: v47.DBStates[storagenodedb.UsedSerialsDBName], + storagenodedb.StorageUsageDBName: v47.DBStates[storagenodedb.StorageUsageDBName], + storagenodedb.ReputationDBName: &DBState{ + SQL: ` + -- table to store nodestats cache + CREATE TABLE reputation ( + satellite_id BLOB NOT NULL, + audit_success_count INTEGER NOT NULL, + audit_total_count INTEGER NOT NULL, + audit_reputation_alpha REAL NOT NULL, + audit_reputation_beta REAL NOT NULL, + audit_reputation_score REAL NOT NULL, + audit_unknown_reputation_alpha REAL NOT NULL, + audit_unknown_reputation_beta REAL NOT NULL, + audit_unknown_reputation_score REAL NOT NULL, + online_score REAL NOT NULL, + audit_history BLOB, + disqualified_at TIMESTAMP, + updated_at TIMESTAMP NOT NULL, + suspended_at TIMESTAMP, + offline_suspended_at TIMESTAMP, + offline_under_review_at TIMESTAMP, + joined_at TIMESTAMP NOT NULL, + PRIMARY KEY (satellite_id) + ); + INSERT INTO reputation VALUES(X'0ed28abb2813e184a1e98b0f6605c4911ea468c7e8433eb583e0fca7ceac3000',1,1,1.0,1.0,1.0,1.0,1.0,1.0,1.0,NULL,'2019-07-19 20:00:00+00:00','2019-08-23 20:00:00+00:00',NULL,NULL,NULL,'1970-01-01 00:00:00+00:00'); + `, + }, + storagenodedb.PieceSpaceUsedDBName: v47.DBStates[storagenodedb.PieceSpaceUsedDBName], + storagenodedb.PieceInfoDBName: v47.DBStates[storagenodedb.PieceInfoDBName], + storagenodedb.PieceExpirationDBName: v47.DBStates[storagenodedb.PieceExpirationDBName], + storagenodedb.OrdersDBName: v47.DBStates[storagenodedb.OrdersDBName], + storagenodedb.BandwidthDBName: v47.DBStates[storagenodedb.BandwidthDBName], + storagenodedb.SatellitesDBName: v47.DBStates[storagenodedb.SatellitesDBName], + storagenodedb.DeprecatedInfoDBName: v47.DBStates[storagenodedb.DeprecatedInfoDBName], + storagenodedb.NotificationsDBName: v47.DBStates[storagenodedb.NotificationsDBName], + storagenodedb.HeldAmountDBName: v47.DBStates[storagenodedb.HeldAmountDBName], + storagenodedb.PricingDBName: v47.DBStates[storagenodedb.PricingDBName], + storagenodedb.APIKeysDBName: v47.DBStates[storagenodedb.APIKeysDBName]}, +} diff --git a/web/storagenode/src/app/components/ChecksArea.vue b/web/storagenode/src/app/components/ChecksArea.vue index ad5bcd661..4bf520e17 100644 --- a/web/storagenode/src/app/components/ChecksArea.vue +++ b/web/storagenode/src/app/components/ChecksArea.vue @@ -15,7 +15,7 @@ -

{{ value }}%

+

{{ amount }}

@@ -36,7 +36,7 @@ export default class ChecksArea extends Vue { @Prop({default: ''}) private readonly label: string; @Prop({default: ''}) - private readonly amount: number; + private readonly amount: string; @Prop({default: ''}) private readonly infoText: string; @@ -51,10 +51,6 @@ export default class ChecksArea extends Vue { public toggleTooltipVisibility(): void { this.isTooltipVisible = !this.isTooltipVisible; } - - public get value(): string { - return this.amount.toFixed(2); - } } diff --git a/web/storagenode/src/app/components/SNOContentFilling.vue b/web/storagenode/src/app/components/SNOContentFilling.vue index 2802ea33f..3d57d7111 100644 --- a/web/storagenode/src/app/components/SNOContentFilling.vue +++ b/web/storagenode/src/app/components/SNOContentFilling.vue @@ -126,12 +126,12 @@
@@ -175,20 +175,7 @@ import LargeSuspensionIcon from '@/../static/images/largeSuspend.svg'; import { RouteConfig } from '@/app/router'; import { APPSTATE_ACTIONS } from '@/app/store/modules/appState'; import { formatBytes } from '@/app/utils/converter'; -import { SatelliteInfo } from '@/storagenode/sno/sno'; - -/** - * Checks class holds info for Checks entity. - */ -class Checks { - public uptime: number; - public audit: number; - - public constructor(uptime: number, audit: number) { - this.uptime = uptime; - this.audit = audit; - } -} +import { SatelliteInfo, SatelliteScores } from '@/storagenode/sno/sno'; @Component ({ components: { @@ -343,11 +330,11 @@ export default class SNOContentFilling extends Vue { } /** - * checks - uptime and audit checks statuses from store. - * @return Checks - uptime and audit checks statuses + * checks - audit checks status from store. + * @return Checks - audit checks statuses */ - public get checks(): Checks { - return this.$store.state.node.checks; + public get audits(): SatelliteScores { + return this.$store.state.node.audits; } /** diff --git a/web/storagenode/src/app/components/payments/HeldHistoryArea.vue b/web/storagenode/src/app/components/payments/HeldHistoryArea.vue index 026ae9c01..84c3c41f7 100644 --- a/web/storagenode/src/app/components/payments/HeldHistoryArea.vue +++ b/web/storagenode/src/app/components/payments/HeldHistoryArea.vue @@ -54,14 +54,6 @@ export default class HeldHistoryArea extends Vue { */ public isAllStatsShown: boolean = true; - /** - * Lifecycle hook before component render. - * Fetches held history information. - */ - public beforeMount(): void { - this.$store.dispatch(PAYOUT_ACTIONS.GET_HELD_HISTORY); - } - /** * Sets held history table state to All Stats. */ diff --git a/web/storagenode/src/app/store/modules/node.ts b/web/storagenode/src/app/store/modules/node.ts index 453893dda..efd1955f5 100644 --- a/web/storagenode/src/app/store/modules/node.ts +++ b/web/storagenode/src/app/store/modules/node.ts @@ -7,13 +7,11 @@ import { Duration, millisecondsInSecond, secondsInMinute } from '@/app/utils/dur import { getMonthsBeforeNow } from '@/app/utils/payout'; import { StorageNodeService } from '@/storagenode/sno/service'; import { - Checks, Dashboard, Node, Satellite, SatelliteInfo, Satellites, - Traffic, Utilization, } from '@/storagenode/sno/sno'; @@ -84,7 +82,7 @@ export function newNodeModule(service: StorageNodeService): StoreModule { const testNotification = new Notification( '123', '1234', - NotificationTypes.UptimeCheckFailure, + NotificationTypes.AuditCheckFailure, 'title1', 'message1', ); diff --git a/web/storagenode/tests/unit/components/notifications/__snapshots__/SNONotification.spec.ts.snap b/web/storagenode/tests/unit/components/notifications/__snapshots__/SNONotification.spec.ts.snap index 653d3ace6..a124ea8b7 100644 --- a/web/storagenode/tests/unit/components/notifications/__snapshots__/SNONotification.spec.ts.snap +++ b/web/storagenode/tests/unit/components/notifications/__snapshots__/SNONotification.spec.ts.snap @@ -6,8 +6,9 @@ exports[`SNONotification renders correctly 1`] = `
- -
+ + +

title1: message1 diff --git a/web/storagenode/tests/unit/components/payments/EstimationPeriodDropdown.spec.ts b/web/storagenode/tests/unit/components/payments/EstimationPeriodDropdown.spec.ts index 69a5f51a2..79b638308 100644 --- a/web/storagenode/tests/unit/components/payments/EstimationPeriodDropdown.spec.ts +++ b/web/storagenode/tests/unit/components/payments/EstimationPeriodDropdown.spec.ts @@ -14,7 +14,7 @@ import { Dashboard, Metric, Satellite, - SatelliteInfo, + SatelliteInfo, SatelliteScores, Stamp, Traffic, } from '@/storagenode/sno/sno'; @@ -55,8 +55,7 @@ describe('EstimationPeriodDropdown', (): void => { 222, 50, 70, - new Metric(1, 1, 1, 0, 1, 0, 0, 1), - new Metric(2, 1, 1, 0, 1, 0, 0, 1), + new SatelliteScores('', 1, 0, 0), new Date(), ); diff --git a/web/storagenode/tests/unit/components/payments/HeldHistoryArea.spec.ts b/web/storagenode/tests/unit/components/payments/HeldHistoryArea.spec.ts index 7eefcd6a7..e9d20b1cd 100644 --- a/web/storagenode/tests/unit/components/payments/HeldHistoryArea.spec.ts +++ b/web/storagenode/tests/unit/components/payments/HeldHistoryArea.spec.ts @@ -20,14 +20,12 @@ const payoutModule = newPayoutModule(payoutService); const store = new Vuex.Store({ modules: { payoutModule }}); describe('HeldHistoryArea', (): void => { - it('renders correctly', async (): Promise => { + it('renders correctly', (): void => { const wrapper = shallowMount(HeldHistoryArea, { store, localVue, }); - await localVue.nextTick(); - expect(wrapper).toMatchSnapshot(); }); @@ -37,15 +35,11 @@ describe('HeldHistoryArea', (): void => { localVue, }); - wrapper.findAll('.held-history-container__header__selection-area__item').at(1).trigger('click'); - - await localVue.nextTick(); + await wrapper.findAll('.held-history-container__header__selection-area__item').at(1).trigger('click'); expect(wrapper).toMatchSnapshot(); - wrapper.findAll('.held-history-container__header__selection-area__item').at(0).trigger('click'); - - await localVue.nextTick(); + await wrapper.findAll('.held-history-container__header__selection-area__item').at(0).trigger('click'); expect(wrapper).toMatchSnapshot(); }); diff --git a/web/storagenode/tests/unit/components/payments/TotalHeldArea.spec.ts b/web/storagenode/tests/unit/components/payments/TotalHeldArea.spec.ts index 75b51a716..1c984b576 100644 --- a/web/storagenode/tests/unit/components/payments/TotalHeldArea.spec.ts +++ b/web/storagenode/tests/unit/components/payments/TotalHeldArea.spec.ts @@ -12,7 +12,7 @@ import { StorageNodeApi } from '@/storagenode/api/storagenode'; import { Paystub, TotalHeldAndPaid } from '@/storagenode/payouts/payouts'; import { PayoutService } from '@/storagenode/payouts/service'; import { StorageNodeService } from '@/storagenode/sno/service'; -import { Metric, Satellite, Stamp } from '@/storagenode/sno/sno'; +import { Metric, Satellite, SatelliteScores, Stamp } from '@/storagenode/sno/sno'; import { createLocalVue, shallowMount } from '@vue/test-utils'; const localVue = createLocalVue(); @@ -59,8 +59,7 @@ describe('TotalHeldArea', (): void => { 222, 50, 70, - new Metric(1, 1, 1, 0, 1), - new Metric(2, 1, 1, 0, 1), + new SatelliteScores('', 1, 0, 0), testJoinAt, ); const paystub = new Paystub(); diff --git a/web/storagenode/tests/unit/store/node.spec.ts b/web/storagenode/tests/unit/store/node.spec.ts index 20b62b9c2..c2e201bd4 100644 --- a/web/storagenode/tests/unit/store/node.spec.ts +++ b/web/storagenode/tests/unit/store/node.spec.ts @@ -13,7 +13,6 @@ import { EgressUsed, Ingress, IngressUsed, - Metric, Satellite, SatelliteInfo, Satellites, @@ -79,17 +78,15 @@ describe('mutations', () => { 222, 50, 70, - new Metric(1, 1, 1, 0, 1, 0, 0, 1), - new Metric(2, 1, 1, 0, 1), + new SatelliteScores('', 1, 0, 0), new Date(2019, 3, 1), ); store.commit(NODE_MUTATIONS.SELECT_SATELLITE, satelliteInfo); expect(state.node.selectedSatellite.id).toBe(satelliteInfo.id); - expect(state.node.checks.audit).toBe(0); - expect(state.node.checks.uptime).toBe(50); - expect(state.node.checks.suspension).toBe(100); + expect(state.node.audits.auditScore.label).toBe('100 %'); + expect(state.node.audits.suspensionScore.label).toBe('0 %'); }); it('don`t selects wrong satellite', () => { @@ -143,8 +140,7 @@ describe('mutations', () => { 222, 50, 70, - new Metric(1, 1, 1, 0, 1), - new Metric(2, 1, 1, 0, 1), + new SatelliteScores('', 100, 200, 300), new Date(2019, 3, 1), ); @@ -244,8 +240,7 @@ describe('actions', () => { 2221, 501, 701, - new Metric(1, 1, 1, 0, 1), - new Metric(2, 1, 1, 0, 1), + new SatelliteScores('', 100, 200, 0.2), new Date(2019, 3, 1), ), ), @@ -262,6 +257,7 @@ describe('actions', () => { expect(state.node.egressSummary).toBe(501); expect(state.node.ingressSummary).toBe(701); expect(state.node.storageSummary).toBe(1111); + expect(state.node.audits.onlineScore.label).toBe('20 %'); }); it('fetch all satellites info throws error on api call fail', async () => { @@ -313,8 +309,7 @@ describe('getters', () => { 222, 50, 70, - new Metric(1, 1, 1, 0, 1), - new Metric(2, 1, 1, 0, 1), + new SatelliteScores('', 100, 200, 300), testJoinAt, ); diff --git a/web/storagenode/tests/unit/store/notifications.spec.ts b/web/storagenode/tests/unit/store/notifications.spec.ts index 6d968004a..f3b0a5d3f 100644 --- a/web/storagenode/tests/unit/store/notifications.spec.ts +++ b/web/storagenode/tests/unit/store/notifications.spec.ts @@ -35,7 +35,7 @@ describe('mutations', () => { createLocalVue().use(Vuex); notifications = [ new UINotification(new Notification('1', '1', NotificationTypes.Disqualification, 'title1', 'message1', null)), - new UINotification(new Notification('2', '1', NotificationTypes.UptimeCheckFailure, 'title2', 'message2', null)), + new UINotification(new Notification('2', '1', NotificationTypes.AuditCheckFailure, 'title2', 'message2', null)), ]; }); @@ -75,7 +75,7 @@ describe('actions', () => { jest.resetAllMocks(); notifications = [ new UINotification(new Notification('1', '1', NotificationTypes.Disqualification, 'title1', 'message1', null)), - new UINotification(new Notification('2', '1', NotificationTypes.UptimeCheckFailure, 'title2', 'message2', null)), + new UINotification(new Notification('2', '1', NotificationTypes.AuditCheckFailure, 'title2', 'message2', null)), ]; });