Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
38657da7
Commit
38657da7
authored
Sep 17, 2019
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves job log specs to jest
Fixes technical debt
parent
bfee33bf
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
176 additions
and
157 deletions
+176
-157
spec/frontend/jobs/components/log/duration_badge_spec.js
spec/frontend/jobs/components/log/duration_badge_spec.js
+0
-0
spec/frontend/jobs/components/log/line_header_spec.js
spec/frontend/jobs/components/log/line_header_spec.js
+0
-0
spec/frontend/jobs/components/log/line_number_spec.js
spec/frontend/jobs/components/log/line_number_spec.js
+0
-0
spec/frontend/jobs/components/log/line_spec.js
spec/frontend/jobs/components/log/line_spec.js
+0
-0
spec/frontend/jobs/components/log/log_spec.js
spec/frontend/jobs/components/log/log_spec.js
+1
-1
spec/frontend/jobs/components/log/mock_data.js
spec/frontend/jobs/components/log/mock_data.js
+152
-0
spec/frontend/jobs/store/utils_spec.js
spec/frontend/jobs/store/utils_spec.js
+23
-130
spec/javascripts/jobs/components/log/mock_data.js
spec/javascripts/jobs/components/log/mock_data.js
+0
-26
No files found.
spec/
javascripts
/jobs/components/log/duration_badge_spec.js
→
spec/
frontend
/jobs/components/log/duration_badge_spec.js
View file @
38657da7
File moved
spec/
javascripts
/jobs/components/log/line_header_spec.js
→
spec/
frontend
/jobs/components/log/line_header_spec.js
View file @
38657da7
File moved
spec/
javascripts
/jobs/components/log/line_number_spec.js
→
spec/
frontend
/jobs/components/log/line_number_spec.js
View file @
38657da7
File moved
spec/
javascripts
/jobs/components/log/line_spec.js
→
spec/
frontend
/jobs/components/log/line_spec.js
View file @
38657da7
File moved
spec/
javascripts
/jobs/components/log/log_spec.js
→
spec/
frontend
/jobs/components/log/log_spec.js
View file @
38657da7
...
@@ -66,7 +66,7 @@ describe('Job Log', () => {
...
@@ -66,7 +66,7 @@ describe('Job Log', () => {
describe
(
'
on click header section
'
,
()
=>
{
describe
(
'
on click header section
'
,
()
=>
{
it
(
'
calls toggleCollapsibleLine
'
,
()
=>
{
it
(
'
calls toggleCollapsibleLine
'
,
()
=>
{
spyOn
(
wrapper
.
vm
,
'
toggleCollapsibleLine
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
wrapper
.
vm
,
'
toggleCollapsibleLine
'
);
wrapper
.
find
(
'
.collapsible-line
'
).
trigger
(
'
click
'
);
wrapper
.
find
(
'
.collapsible-line
'
).
trigger
(
'
click
'
);
...
...
spec/frontend/jobs/components/log/mock_data.js
0 → 100644
View file @
38657da7
export
const
jobLog
=
[
{
offset
:
1000
,
content
:
[{
text
:
'
Running with gitlab-runner 12.1.0 (de7731dd)
'
}],
},
{
offset
:
1001
,
content
:
[{
text
:
'
on docker-auto-scale-com 8a6210b8
'
}],
},
{
offset
:
1002
,
content
:
[
{
text
:
'
Using Docker executor with image dev.gitlab.org3
'
,
},
],
sections
:
[
'
prepare-executor
'
],
section_header
:
true
,
},
{
offset
:
1003
,
content
:
[{
text
:
'
Starting service postgres:9.6.14 ...
'
,
style
:
'
text-green
'
}],
sections
:
[
'
prepare-executor
'
],
},
];
export
const
utilsMockData
=
[
{
offset
:
1001
,
content
:
[{
text
:
'
on docker-auto-scale-com 8a6210b8
'
}],
},
{
offset
:
1002
,
content
:
[
{
text
:
'
Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33
'
,
},
],
sections
:
[
'
prepare-executor
'
],
section_header
:
true
,
},
{
offset
:
1003
,
content
:
[{
text
:
'
Starting service postgres:9.6.14 ...
'
}],
sections
:
[
'
prepare-executor
'
],
},
{
offset
:
1004
,
content
:
[{
text
:
'
Pulling docker image postgres:9.6.14 ...
'
,
style
:
'
term-fg-l-green
'
}],
sections
:
[
'
prepare-executor
'
],
},
{
offset
:
1005
,
content
:
[],
sections
:
[
'
prepare-executor
'
],
section_duration
:
'
10:00
'
,
},
];
export
const
originalTrace
=
[
{
offset
:
1
,
content
:
[
{
text
:
'
Downloading
'
,
},
],
},
];
export
const
regularIncremental
=
[
{
offset
:
2
,
content
:
[
{
text
:
'
log line
'
,
},
],
},
];
export
const
regularIncrementalRepeated
=
[
{
offset
:
1
,
content
:
[
{
text
:
'
log line
'
,
},
],
},
];
export
const
headerTrace
=
[
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
export
const
headerTraceIncremental
=
[
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
updated log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
export
const
collapsibleTrace
=
[
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
{
offset
:
2
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
export
const
collapsibleTraceIncremental
=
[
{
offset
:
2
,
content
:
[
{
text
:
'
updated log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
spec/frontend/jobs/store/utils_spec.js
View file @
38657da7
import
{
logLinesParser
,
updateIncrementalTrace
}
from
'
~/jobs/store/utils
'
;
import
{
logLinesParser
,
updateIncrementalTrace
}
from
'
~/jobs/store/utils
'
;
import
{
utilsMockData
,
originalTrace
,
regularIncremental
,
regularIncrementalRepeated
,
headerTrace
,
headerTraceIncremental
,
collapsibleTrace
,
collapsibleTraceIncremental
,
}
from
'
../components/log/mock_data
'
;
describe
(
'
Jobs Store Utils
'
,
()
=>
{
describe
(
'
Jobs Store Utils
'
,
()
=>
{
describe
(
'
logLinesParser
'
,
()
=>
{
describe
(
'
logLinesParser
'
,
()
=>
{
const
mockData
=
[
{
offset
:
1001
,
content
:
[{
text
:
'
on docker-auto-scale-com 8a6210b8
'
}],
},
{
offset
:
1002
,
content
:
[
{
text
:
'
Using Docker executor with image dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.22-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.33
'
,
},
],
sections
:
[
'
prepare-executor
'
],
section_header
:
true
,
},
{
offset
:
1003
,
content
:
[{
text
:
'
Starting service postgres:9.6.14 ...
'
}],
sections
:
[
'
prepare-executor
'
],
},
{
offset
:
1004
,
content
:
[{
text
:
'
Pulling docker image postgres:9.6.14 ...
'
,
style
:
'
term-fg-l-green
'
}],
sections
:
[
'
prepare-executor
'
],
},
{
offset
:
1005
,
content
:
[],
sections
:
[
'
prepare-executor
'
],
section_duration
:
'
10:00
'
,
},
];
let
result
;
let
result
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
result
=
logLinesParser
(
m
ockData
);
result
=
logLinesParser
(
utilsM
ockData
);
});
});
describe
(
'
regular line
'
,
()
=>
{
describe
(
'
regular line
'
,
()
=>
{
...
@@ -60,48 +36,27 @@ describe('Jobs Store Utils', () => {
...
@@ -60,48 +36,27 @@ describe('Jobs Store Utils', () => {
it
(
'
creates a lines array property with the content of the collpasible section
'
,
()
=>
{
it
(
'
creates a lines array property with the content of the collpasible section
'
,
()
=>
{
expect
(
result
[
1
].
lines
.
length
).
toEqual
(
2
);
expect
(
result
[
1
].
lines
.
length
).
toEqual
(
2
);
expect
(
result
[
1
].
lines
[
0
].
content
).
toEqual
(
m
ockData
[
2
].
content
);
expect
(
result
[
1
].
lines
[
0
].
content
).
toEqual
(
utilsM
ockData
[
2
].
content
);
expect
(
result
[
1
].
lines
[
1
].
content
).
toEqual
(
m
ockData
[
3
].
content
);
expect
(
result
[
1
].
lines
[
1
].
content
).
toEqual
(
utilsM
ockData
[
3
].
content
);
});
});
});
});
describe
(
'
section duration
'
,
()
=>
{
describe
(
'
section duration
'
,
()
=>
{
it
(
'
adds the section information to the header section
'
,
()
=>
{
it
(
'
adds the section information to the header section
'
,
()
=>
{
expect
(
result
[
1
].
section_duration
).
toEqual
(
m
ockData
[
4
].
section_duration
);
expect
(
result
[
1
].
section_duration
).
toEqual
(
utilsM
ockData
[
4
].
section_duration
);
});
});
it
(
'
does not add section duration as a line
'
,
()
=>
{
it
(
'
does not add section duration as a line
'
,
()
=>
{
expect
(
result
[
1
].
lines
.
includes
(
m
ockData
[
4
])).
toEqual
(
false
);
expect
(
result
[
1
].
lines
.
includes
(
utilsM
ockData
[
4
])).
toEqual
(
false
);
});
});
});
});
});
});
describe
(
'
updateIncrementalTrace
'
,
()
=>
{
describe
(
'
updateIncrementalTrace
'
,
()
=>
{
const
originalTrace
=
[
{
offset
:
1
,
content
:
[
{
text
:
'
Downloading
'
,
},
],
},
];
describe
(
'
without repeated section
'
,
()
=>
{
describe
(
'
without repeated section
'
,
()
=>
{
it
(
'
concats and parses both arrays
'
,
()
=>
{
it
(
'
concats and parses both arrays
'
,
()
=>
{
const
oldLog
=
logLinesParser
(
originalTrace
);
const
oldLog
=
logLinesParser
(
originalTrace
);
const
newLog
=
[
const
result
=
updateIncrementalTrace
(
originalTrace
,
oldLog
,
regularIncremental
);
{
offset
:
2
,
content
:
[
{
text
:
'
log line
'
,
},
],
},
];
const
result
=
updateIncrementalTrace
(
originalTrace
,
oldLog
,
newLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -129,17 +84,7 @@ describe('Jobs Store Utils', () => {
...
@@ -129,17 +84,7 @@ describe('Jobs Store Utils', () => {
describe
(
'
with regular line repeated offset
'
,
()
=>
{
describe
(
'
with regular line repeated offset
'
,
()
=>
{
it
(
'
updates the last line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the last line and formats with the incremental part
'
,
()
=>
{
const
oldLog
=
logLinesParser
(
originalTrace
);
const
oldLog
=
logLinesParser
(
originalTrace
);
const
newLog
=
[
const
result
=
updateIncrementalTrace
(
originalTrace
,
oldLog
,
regularIncrementalRepeated
);
{
offset
:
1
,
content
:
[
{
text
:
'
log line
'
,
},
],
},
];
const
result
=
updateIncrementalTrace
(
originalTrace
,
oldLog
,
newLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -157,32 +102,8 @@ describe('Jobs Store Utils', () => {
...
@@ -157,32 +102,8 @@ describe('Jobs Store Utils', () => {
describe
(
'
with header line repeated
'
,
()
=>
{
describe
(
'
with header line repeated
'
,
()
=>
{
it
(
'
updates the header line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the header line and formats with the incremental part
'
,
()
=>
{
const
headerTrace
=
[
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
const
oldLog
=
logLinesParser
(
headerTrace
);
const
oldLog
=
logLinesParser
(
headerTrace
);
const
newLog
=
[
const
result
=
updateIncrementalTrace
(
headerTrace
,
oldLog
,
headerTraceIncremental
);
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
updated log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
const
result
=
updateIncrementalTrace
(
headerTrace
,
oldLog
,
newLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
@@ -207,40 +128,12 @@ describe('Jobs Store Utils', () => {
...
@@ -207,40 +128,12 @@ describe('Jobs Store Utils', () => {
describe
(
'
with collapsible line repeated
'
,
()
=>
{
describe
(
'
with collapsible line repeated
'
,
()
=>
{
it
(
'
updates the collapsible line and formats with the incremental part
'
,
()
=>
{
it
(
'
updates the collapsible line and formats with the incremental part
'
,
()
=>
{
const
collapsibleTrace
=
[
{
offset
:
1
,
section_header
:
true
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
{
offset
:
2
,
content
:
[
{
text
:
'
log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
const
oldLog
=
logLinesParser
(
collapsibleTrace
);
const
oldLog
=
logLinesParser
(
collapsibleTrace
);
const
newLog
=
[
const
result
=
updateIncrementalTrace
(
{
collapsibleTrace
,
offset
:
2
,
oldLog
,
content
:
[
collapsibleTraceIncremental
,
{
);
text
:
'
updated log line
'
,
},
],
sections
:
[
'
section
'
],
},
];
const
result
=
updateIncrementalTrace
(
collapsibleTrace
,
oldLog
,
newLog
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
{
...
...
spec/javascripts/jobs/components/log/mock_data.js
deleted
100644 → 0
View file @
bfee33bf
// eslint-disable-next-line import/prefer-default-export
export
const
jobLog
=
[
{
offset
:
1000
,
content
:
[{
text
:
'
Running with gitlab-runner 12.1.0 (de7731dd)
'
}],
},
{
offset
:
1001
,
content
:
[{
text
:
'
on docker-auto-scale-com 8a6210b8
'
}],
},
{
offset
:
1002
,
content
:
[
{
text
:
'
Using Docker executor with image dev.gitlab.org3
'
,
},
],
sections
:
[
'
prepare-executor
'
],
section_header
:
true
,
},
{
offset
:
1003
,
content
:
[{
text
:
'
Starting service postgres:9.6.14 ...
'
,
style
:
'
text-green
'
}],
sections
:
[
'
prepare-executor
'
],
},
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment