Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PA165 - Airport - project
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ján Macháček
PA165 - Airport - project
Commits
b50d2d4c
There was an error fetching the commit references. Please try again later.
Commit
b50d2d4c
authored
1 year ago
by
Ján Macháček
Committed by
Martin Slovík
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
CI: adding integration tests and artifacts
parent
af67ee1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+28
-5
28 additions, 5 deletions
.gitlab-ci.yml
report/src/test/java/cz/muni/fi/pa165/report/server/ReportIT.java
+10
-18
10 additions, 18 deletions
...rc/test/java/cz/muni/fi/pa165/report/server/ReportIT.java
with
38 additions
and
23 deletions
.gitlab-ci.yml
+
28
−
5
View file @
b50d2d4c
...
...
@@ -10,7 +10,8 @@ variables:
stages
:
-
build
-
test
-
unit_test
-
integration_test
build
:
tags
:
...
...
@@ -21,10 +22,32 @@ build:
-
ls
-
./mvnw clean install -Dmaven.test.skip=true $MAVEN_CLI_OPTS
test
:
unit_
test
:
tags
:
-
shared-fi
stage
:
test
stage
:
unit_
test
script
:
-
echo "We are testing your project build, $GITLAB_USER_LOGIN"
-
./mvnw test $MAVEN_CLI_OPTS
\ No newline at end of file
-
echo "We are testing your project build with unit tests, $GITLAB_USER_LOGIN"
-
./mvnw test $MAVEN_CLI_OPTS
artifacts
:
expire_in
:
10 min
paths
:
-
"
*/target/surefire-reports/*"
reports
:
junit
:
-
"
*/target/surefire-reports/*"
integration_test
:
tags
:
-
shared-fi
stage
:
integration_test
script
:
-
echo "We are testing your project build with integration tests, $GITLAB_USER_LOGIN"
-
./mvnw verify $MAVEN_CLI_OPTS
artifacts
:
expire_in
:
10 min
paths
:
-
"
*/target/failsafe-reports/*"
reports
:
junit
:
-
"
*/target/failsafe-reports/*"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
report/src/test/java/cz/muni/fi/pa165/report/server/ReportIT.java
+
10
−
18
View file @
b50d2d4c
...
...
@@ -3,7 +3,7 @@ package cz.muni.fi.pa165.report.server;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -11,9 +11,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
import
org.springframework.core.io.ByteArrayResource
;
import
org.springframework.test.web.servlet.MockMvc
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
...
...
@@ -41,16 +39,14 @@ class ReportIT {
ClassLoader
classLoader
=
getClass
().
getClassLoader
();
try
(
InputStream
inputStream
=
classLoader
.
getResourceAsStream
(
"sample.pdf"
)){
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()]
;
inputStream
.
read
(
b
ytes
);
assert
inputStream
!=
null
;
byte
[]
bytes
=
inputStream
.
read
AllB
ytes
(
);
ByteArrayResource
resource
=
new
ByteArrayResource
(
bytes
);
var
response
=
mockMvc
.
perform
(
get
(
"/api/reports/flight/1"
))
.
andExpect
(
status
().
isOk
())
.
andReturn
().
getResponse
().
getContentAsByteArray
();
assertThat
(
Arrays
.
equals
(
response
,
resource
.
getByteArray
())
)
;
assertThat
(
response
).
isEqualTo
(
resource
.
getByteArray
());
log
.
debug
(
"response: {}"
,
response
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
...
...
@@ -62,16 +58,14 @@ class ReportIT {
ClassLoader
classLoader
=
getClass
().
getClassLoader
();
try
(
InputStream
inputStream
=
classLoader
.
getResourceAsStream
(
"sample.pdf"
)){
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()]
;
inputStream
.
read
(
b
ytes
);
assert
inputStream
!=
null
;
byte
[]
bytes
=
inputStream
.
read
AllB
ytes
(
);
ByteArrayResource
resource
=
new
ByteArrayResource
(
bytes
);
var
response
=
mockMvc
.
perform
(
get
(
"/api/reports/airport/1"
))
.
andExpect
(
status
().
isOk
())
.
andReturn
().
getResponse
().
getContentAsByteArray
();
assertThat
(
Arrays
.
equals
(
response
,
resource
.
getByteArray
())
)
;
assertThat
(
response
).
isEqualTo
(
resource
.
getByteArray
());
log
.
debug
(
"response: {}"
,
response
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
...
...
@@ -83,16 +77,14 @@ class ReportIT {
ClassLoader
classLoader
=
getClass
().
getClassLoader
();
try
(
InputStream
inputStream
=
classLoader
.
getResourceAsStream
(
"sample.pdf"
)){
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()]
;
inputStream
.
read
(
b
ytes
);
assert
inputStream
!=
null
;
byte
[]
bytes
=
inputStream
.
read
AllB
ytes
(
);
ByteArrayResource
resource
=
new
ByteArrayResource
(
bytes
);
var
response
=
mockMvc
.
perform
(
get
(
"/api/reports/airplane/1"
))
.
andExpect
(
status
().
isOk
())
.
andReturn
().
getResponse
().
getContentAsByteArray
();
assertThat
(
Arrays
.
equals
(
response
,
resource
.
getByteArray
())
)
;
assertThat
(
response
).
isEqualTo
(
resource
.
getByteArray
());
log
.
debug
(
"response: {}"
,
response
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment