summaryrefslogtreecommitdiff
path: root/spec/frontend/logs/mock_data.js
blob: f9b3508e01cf681a0311b9c1c6419ea36f331714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const mockProjectPath = 'root/autodevops-deploy';

export const mockEnvName = 'production';
export const mockEnvironmentsEndpoint = `${mockProjectPath}/environments.json`;
export const mockEnvId = '99';
export const mockDocumentationPath = '/documentation.md';
export const mockLogsEndpoint = '/dummy_logs_path.json';
export const mockCursor = 'MOCK_CURSOR';
export const mockNextCursor = 'MOCK_NEXT_CURSOR';
export const mockManagedAppName = 'kubernetes-cluster-1';
export const mockManagedAppsEndpoint = `${mockProjectPath}/clusters.json`;

const makeMockEnvironment = (id, name, advancedQuerying) => ({
  id,
  project_path: mockProjectPath,
  name,
  logs_api_path: mockLogsEndpoint,
  enable_advanced_logs_querying: advancedQuerying,
});

export const mockEnvironment = makeMockEnvironment(mockEnvId, mockEnvName, true);
export const mockEnvironments = [
  mockEnvironment,
  makeMockEnvironment(101, 'staging', false),
  makeMockEnvironment(102, 'review/a-feature', false),
];

export const mockManagedApps = [
  {
    cluster_type: 'project_type',
    enabled: true,
    environment_scope: '*',
    name: 'kubernetes-cluster-1',
    provider_type: 'user',
    status: 'connected',
    path: '/root/autodevops-deploy/-/clusters/15',
    gitlab_managed_apps_logs_path: '/root/autodevops-deploy/-/logs?cluster_id=15',
  },
];

export const mockPodName = 'production-764c58d697-aaaaa';
export const mockPods = [
  mockPodName,
  'production-764c58d697-bbbbb',
  'production-764c58d697-ccccc',
  'production-764c58d697-ddddd',
];

export const mockLogsResult = [
  {
    timestamp: '2019-12-13T13:43:18.2760123Z',
    message: 'log line 1',
    pod: 'foo',
  },
  {
    timestamp: '2019-12-13T13:43:18.2760123Z',
    message: 'log line A',
    pod: 'bar',
  },
  {
    timestamp: '2019-12-13T13:43:26.8420123Z',
    message: 'log line 2',
    pod: 'foo',
  },
  {
    timestamp: '2019-12-13T13:43:26.8420123Z',
    message: 'log line B',
    pod: 'bar',
  },
];

export const mockTrace = [
  'Dec 13 13:43:18.276 | foo | log line 1',
  'Dec 13 13:43:18.276 | bar | log line A',
  'Dec 13 13:43:26.842 | foo | log line 2',
  'Dec 13 13:43:26.842 | bar | log line B',
];

export const mockResponse = {
  pod_name: mockPodName,
  pods: mockPods,
  logs: mockLogsResult,
  cursor: mockNextCursor,
};

export const mockSearch = 'foo +bar';