Skip to content

Commit ea9b998

Browse files
committed
skip if not using mocks
1 parent 25d02eb commit ea9b998

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

pkg/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ type Frontend struct {
127127
Deduper Deduper `yaml:"deduper" json:"deduper"`
128128
Fields []FieldConfig `yaml:"fields" json:"fields"`
129129
DataSources []string `yaml:"dataSources" json:"dataSources"`
130+
LokiMocks bool `yaml:"lokiMocks,omitempty" json:"lokiMocks,omitempty"`
130131
PromLabels []string `yaml:"promLabels" json:"promLabels"`
131132
MaxChunkAgeMs int `yaml:"maxChunkAgeMs,omitempty" json:"maxChunkAgeMs,omitempty"` // populated at query time
132133
}
@@ -196,6 +197,7 @@ func ReadFile(version, date, filename string) (*Config, error) {
196197

197198
if cfg.IsLokiEnabled() {
198199
cfg.Frontend.DataSources = append(cfg.Frontend.DataSources, string(constants.DataSourceLoki))
200+
cfg.Frontend.LokiMocks = cfg.Loki.UseMocks
199201
}
200202

201203
if cfg.IsPromEnabled() {

web/cypress/e2e/table/fields.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
/// <reference types="cypress" />
22

3-
import * as c from '../../support/const'
3+
import * as c from '../../support/const';
4+
5+
let useMocks = false
46

57
describe('netflow-table', () => {
68
function reload(clearCache = true) {
9+
cy.intercept({
10+
method: 'GET',
11+
url: c.url + '/api/frontend-config',
12+
}).as('frontend-config')
13+
714
cy.openNetflowTrafficPage(clearCache);
15+
16+
cy.wait('@frontend-config').then((interception) => {
17+
useMocks = interception?.response.body.lokiMocks || false;
18+
})
19+
820
//move to table view
921
cy.get('.tableTabButton').click();
1022
//clear default app filters
@@ -18,6 +30,11 @@ describe('netflow-table', () => {
1830
});
1931

2032
it('display content correctly', () => {
33+
if (!useMocks) {
34+
it.skip("Skipping test since not using mocks");
35+
return
36+
}
37+
2138
// select first row
2239
cy.get('#netflow-table-row-0').click()
2340
// check for side panel content

web/src/model/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export type Config = {
2929
deduper: Deduper;
3030
fields: FieldConfig[];
3131
dataSources: string[];
32+
lokiMocks: boolean;
3233
promLabels: string[];
3334
maxChunkAgeMs?: number;
3435
};
@@ -54,6 +55,7 @@ export const defaultConfig: Config = {
5455
},
5556
fields: [],
5657
dataSources: ['loki', 'prom'],
58+
lokiMocks: false,
5759
promLabels: [],
5860
maxChunkAgeMs: undefined
5961
};

0 commit comments

Comments
 (0)