Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bitia-cli
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
bitia
bitia-cli
Commits
75982f30
Commit
75982f30
authored
2 years ago
by
dilawar
Browse files
Options
Downloads
Patches
Plain Diff
chore: Adds more tests.
parent
a6afae92
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
Hotfix: fix to assert error post installation
Pipeline
#3791
failed with stages
Stage:
Stage:
in 1 minute and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bitia/__main__.py
+7
-3
7 additions, 3 deletions
bitia/__main__.py
tests/test_sanity.py
+10
-1
10 additions, 1 deletion
tests/test_sanity.py
with
17 additions
and
4 deletions
bitia/__main__.py
+
7
−
3
View file @
75982f30
...
...
@@ -96,7 +96,9 @@ def list_containers(user_input):
def
_list_remote_container
(
user_input
)
->
T
.
List
[
str
]:
pipeline
=
bpipeline
.
user_input_to_pipeline
(
user_input
)
logger
.
debug
(
f
"
sha256 of `
{
pipeline
.
zipfile
}
` is `
{
pipeline
.
checksum
}
`
"
)
logger
.
info
(
f
"
Finding container for
{
user_input
}
, sha256sum=
{
pipeline
.
checksum
}
"
)
logger
.
info
(
f
"
Finding container for user input `
{
user_input
}
` with sha256sum=
{
pipeline
.
checksum
}
"
)
res
=
bhelper
.
get
(
endpoint
=
"
container/list
"
,
server
=
bconfig
.
get_server
(),
...
...
@@ -108,10 +110,12 @@ def _list_remote_container(user_input) -> T.List[str]:
@app.command
(
"
logs
"
)
@session
def
stream_log
(
user_input
,
server
:
str
=
bconfig
.
get_server
()
):
def
stream_log
(
user_input
):
"""
Stream logs for the most recent run of a given pipeline.
"""
pipeline
=
bpipeline
.
user_input_to_pipeline
(
user_input
)
logger
.
info
(
f
"
Finding container for
{
user_input
}
, sha256sum=
{
pipeline
.
checksum
}
"
)
logger
.
info
(
f
"
Finding container for user input
{
user_input
}
with sha256sum=
{
pipeline
.
checksum
}
"
)
res
=
bhelper
.
get
(
endpoint
=
"
logs
"
,
params
=
dict
(
pipeline_sha256
=
pipeline
.
checksum
),
...
...
This diff is collapsed.
Click to expand it.
tests/test_sanity.py
+
10
−
1
View file @
75982f30
...
...
@@ -9,6 +9,15 @@ def test_sanity(capsys):
assert
len
(
version
)
>=
3
,
version
def
test_run_repeat
(
capsys
):
bconfig
.
set_config
(
"
plain
"
,
True
)
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
l1
=
capsys
.
readouterr
().
out
# reset the internal buffer.
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
l2
=
capsys
.
readouterr
().
out
assert
l1
==
l2
def
test_run_simple
(
capsys
):
# set the plain-text mode.
bconfig
.
set_config
(
"
plain
"
,
True
)
...
...
@@ -18,4 +27,4 @@ def test_run_simple(capsys):
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
True
)
captured
=
capsys
.
readouterr
()
l2
=
captured
.
out
assert
SequenceMatcher
(
a
=
l1
,
b
=
l2
).
ratio
()
>
0.9
assert
SequenceMatcher
(
a
=
l1
,
b
=
l2
).
ratio
()
>
0.88
# sometime its less than
0.9
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