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
This commit is contained in:
Cameron Ayer 2020-12-18 14:27:28 -05:00
parent b7a0739219
commit c5ecca1e1d
25 changed files with 151 additions and 188 deletions

View File

@ -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(),

View File

@ -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.

View File

@ -27,7 +27,6 @@ type DB interface {
type Stats struct {
SatelliteID storj.NodeID
Uptime Metric
Audit Metric
OnlineScore float64

View File

@ -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,

View File

@ -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
}),
},
},
}
}

View File

@ -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,

View File

@ -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,
},
},
},
},

View File

@ -62,6 +62,7 @@ var States = MultiDBStates{
&v45,
&v46,
&v47,
&v48,
},
}

View File

@ -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]},
}

View File

@ -15,7 +15,7 @@
</div>
</div>
</div>
<p class="checks-area-container__amount"><b>{{ value }}%</b></p>
<p class="checks-area-container__amount"><b>{{ amount }}</b></p>
</div>
</template>
@ -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);
}
}
</script>

View File

@ -126,12 +126,12 @@
<div class="info-area__checks-area" v-if="selectedSatellite.id">
<ChecksArea
label="Suspension Score"
:amount="checks.suspension"
:amount="audits.suspensionScore.label"
info-text="This score shows how close your node is to getting suspended on a satellite. A score of 60% or below will result in suspension. If your node stays suspended for more than one week you will be disqualified from this satellite, so please correct the errors that lead to suspension asap."
/>
<ChecksArea
label="Audit Score"
:amount="checks.audit"
:amount="audits.auditScore.label"
info-text="Percentage of successful pings/communication between the node & satellite."
/>
</div>
@ -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;
}
/**

View File

@ -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.
*/

View File

@ -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<StorageN
satelliteInfo.joinDate,
);
state.checks = new Checks(satelliteInfo.uptime, satelliteInfo.audit);
state.audits = satelliteInfo.audits;
},
[SELECT_ALL_SATELLITES](state: any, satelliteInfo: Satellites): void {
state.selectedSatellite = new SatelliteInfo(

View File

@ -72,9 +72,6 @@ export class UINotification {
case NotificationTypes.AuditCheckFailure:
this.icon = NotificationIcon.FAIL;
break;
case NotificationTypes.UptimeCheckFailure:
this.icon = NotificationIcon.DISQUALIFIED;
break;
case NotificationTypes.Disqualification:
this.icon = NotificationIcon.SOFTWARE_UPDATE;
break;

View File

@ -32,5 +32,5 @@ export class StorageNodeState {
public egressSummary: number = 0;
public ingressSummary: number = 0;
public satellitesScores: SatelliteScores[] = [];
public checks: Checks = new Checks();
public audits: SatelliteScores = new SatelliteScores();
}

View File

@ -66,26 +66,11 @@ export class StorageNodeApi {
const satelliteByDayInfo = new SatelliteByDayInfo(data);
const audit: Metric = new Metric(
data.audit.totalCount,
data.audit.successCount,
data.audit.alpha,
data.audit.beta,
data.audit.unknownAlpha,
data.audit.unknownBeta,
data.audit.score,
data.audit.unknownScore,
);
const uptime: Metric = new Metric(
data.uptime.totalCount,
data.uptime.successCount,
data.uptime.alpha,
data.uptime.beta,
data.uptime.unknownAlpha,
data.uptime.unknownBeta,
data.uptime.score,
data.uptime.unknownScore,
const audits: SatelliteScores = new SatelliteScores(
data.audits.satelliteName,
data.audits.auditScore,
data.audits.suspensionScore,
data.audits.onlineScore,
);
return new Satellite(
@ -98,8 +83,7 @@ export class StorageNodeApi {
data.bandwidthSummary,
data.egressSummary,
data.ingressSummary,
audit,
uptime,
audits,
new Date(data.nodeJoinedAt),
);
}

View File

@ -45,9 +45,8 @@ export class Notification {
export enum NotificationTypes {
Custom = 0,
AuditCheckFailure = 1,
UptimeCheckFailure = 2,
Disqualification = 3,
Suspension = 4,
Disqualification = 2,
Suspension = 3,
}
/**

View File

@ -42,19 +42,16 @@ export class Traffic {
}
/**
* Holds uptime, audit and suspension checks.
* Holds audit and suspension checks.
*/
export class Checks {
public uptime: number = 0;
public audit: number = 0;
public suspension: number = 0;
public constructor(
uptime: Metric = new Metric(),
audit: Metric = new Metric(),
) {
this.audit = parseFloat(parseFloat(`${audit.score * 100}`).toFixed(1));
this.uptime = uptime.totalCount === 0 ? 100 : uptime.successCount / uptime.totalCount * 100;
this.suspension = audit.unknownScore * 100;
}
}
@ -104,8 +101,7 @@ export class Satellite {
public bandwidthSummary: number = 0,
public egressSummary: number = 0,
public ingressSummary: number = 0,
public audit: Metric = new Metric(),
public uptime: Metric = new Metric(),
public audits: SatelliteScores = new SatelliteScores(),
public joinDate: Date = new Date(),
) {}
}

View File

@ -36,7 +36,7 @@ describe('SNONotification', (): void => {
const testNotification = new Notification(
'123',
'1234',
NotificationTypes.UptimeCheckFailure,
NotificationTypes.AuditCheckFailure,
'title1',
'message1',
);

View File

@ -6,8 +6,9 @@ exports[`SNONotification renders correctly 1`] = `
<div class="notification-item__new-indicator-container"><span class="notification-item__new-indicator-container__circle"></span></div>
<div class="notification-item__icon-container">
<div class="icon"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.6625 12.9324C15.441 12.5231 15.2181 12.1132 14.996 11.7019C14.5825 10.939 14.1698 10.1761 13.7571 9.41319C13.2614 8.49914 12.7671 7.58367 12.2721 6.66963C11.7939 5.78722 11.3172 4.90619 10.8391 4.02453C10.4875 3.37625 10.1374 2.72727 9.78581 2.07837C9.69089 1.90259 9.59596 1.72682 9.50105 1.55243C9.40261 1.36962 9.29855 1.19384 9.14949 1.04478C8.62918 0.520942 7.76574 0.420394 7.13997 0.816268C6.87137 0.986424 6.67732 1.2276 6.52826 1.50392C6.29975 1.92581 6.07122 2.34767 5.84271 2.77096C5.42646 3.54087 5.00951 4.31081 4.59326 5.08072C4.09192 5.99971 3.59482 6.92086 3.0956 7.84192C2.6231 8.71521 2.1499 9.58707 1.6767 10.4611C1.33076 11.1009 0.984114 11.7394 0.637488 12.3792C0.546082 12.5479 0.45468 12.7167 0.363276 12.8854C0.235307 13.1231 0.134766 13.3635 0.103122 13.6378C0.013826 14.4126 0.556632 15.1762 1.30687 15.3661C1.50516 15.4167 1.70062 15.4188 1.90102 15.4188H14.276H14.2957C14.7035 15.4104 15.0902 15.2571 15.3891 14.9793C15.6773 14.7122 15.8461 14.3465 15.8939 13.9598C15.9396 13.5956 15.8341 13.2511 15.6626 12.9325L15.6625 12.9324ZM7.29666 5.27876C7.29666 4.88501 7.6187 4.59321 7.99978 4.57564C8.37947 4.55806 8.70289 4.91174 8.70289 5.27876V10.2302C8.70289 10.6239 8.38085 10.9157 7.99978 10.9333C7.62008 10.9509 7.29666 10.5972 7.29666 10.2302V5.27876ZM7.99978 13.3282C7.60462 13.3282 7.28399 13.0083 7.28399 12.6124C7.28399 12.2172 7.6039 11.8966 7.99978 11.8966C8.39493 11.8966 8.71556 12.2165 8.71556 12.6124C8.71556 13.0075 8.39495 13.3282 7.99978 13.3282Z" fill="#535F77"></path>
</svg></div>
<path class="close-cross-svg-path" d="M15.7071 1.70711C16.0976 1.31658 16.0976 0.683417 15.7071 0.292893C15.3166 -0.0976311 14.6834 -0.0976311 14.2929 0.292893L15.7071 1.70711ZM0.292893 14.2929C-0.0976311 14.6834 -0.0976311 15.3166 0.292893 15.7071C0.683417 16.0976 1.31658 16.0976 1.70711 15.7071L0.292893 14.2929ZM1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L1.70711 0.292893ZM14.2929 15.7071C14.6834 16.0976 15.3166 16.0976 15.7071 15.7071C16.0976 15.3166 16.0976 14.6834 15.7071 14.2929L14.2929 15.7071ZM14.2929 0.292893L0.292893 14.2929L1.70711 15.7071L15.7071 1.70711L14.2929 0.292893ZM0.292893 1.70711L14.2929 15.7071L15.7071 14.2929L1.70711 0.292893L0.292893 1.70711Z" fill="#384B65"></path>
</svg>
</div>
</div>
<div class="notification-item__text-container">
<p class="notification-item__text-container__message"><b class="notification-item__text-container__message__bold">title1:</b> message1

View File

@ -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(),
);

View File

@ -20,14 +20,12 @@ const payoutModule = newPayoutModule(payoutService);
const store = new Vuex.Store({ modules: { payoutModule }});
describe('HeldHistoryArea', (): void => {
it('renders correctly', async (): Promise<void> => {
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();
});

View File

@ -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();

View File

@ -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,
);

View File

@ -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)),
];
});