FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
semaphore-ex/db/sql/docker_execution_policy_test.go at develop · freefair/semaphore-ex · GitHub
freefair
/
semaphore-ex
Public
forked from
semaphoreui/semaphore
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
semaphore-ex
/
db
/
sql
/
docker_execution_policy_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (27 loc) · 1.1 KB
Breadcrumbs
semaphore-ex
/
db
/
sql
/
docker_execution_policy_test.go
Copy path
File metadata and controls
34 lines (27 loc) · 1.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
sql
import
(
"testing"
"github.com/semaphoreui/semaphore/db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestDockerExecutionPolicyStoreReturnsFailClosedDefaultUntilFirstSave
(
t
*
testing.
T
) {
store
:=
InitConfigCreateTestStore
()
t
.
Cleanup
(
store
.
Close
)
count
,
err
:=
store
.
Sql
().
SelectInt
(
store
.
PrepareQuery
(
"select count(1) from docker_execution_policy"
))
require
.
NoError
(
t
,
err
)
assert
.
Zero
(
t
,
count
)
initial
,
err
:=
store
.
GetDockerExecutionPolicy
()
require
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
db
.
DefaultDockerExecutionPolicy
(),
initial
)
initial
.
AllowedImages
=
[]
string
{
"registry.example.test/job@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
saved
,
err
:=
store
.
SaveDockerExecutionPolicy
(
initial
,
initial
.
Revision
)
require
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
1
,
saved
.
Revision
)
assert
.
NotEmpty
(
t
,
saved
.
Hash
)
_
,
err
=
store
.
SaveDockerExecutionPolicy
(
saved
,
0
)
assert
.
ErrorIs
(
t
,
err
,
db
.
ErrDockerExecutionPolicyRevisionConflict
)
loaded
,
err
:=
store
.
GetDockerExecutionPolicy
()
require
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
saved
,
loaded
)
}
Back
|
FazBrowse Home
|
New Git URL