Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
5c4408f6
Commit
5c4408f6
authored
10 months ago
by
Danis Kirasirov
Browse files
Options
Downloads
Patches
Plain Diff
fix linter
parent
cf5b9cbb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/setup/collection_test.go
+5
-5
5 additions, 5 deletions
pkg/setup/collection_test.go
with
5 additions
and
5 deletions
pkg/setup/collection_test.go
+
5
−
5
View file @
5c4408f6
...
@@ -175,7 +175,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
...
@@ -175,7 +175,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
nil
)
.
Once
()
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
nil
)
.
Once
()
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
_
,
_
=
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
require
.
NoError
(
t
,
err
,
"Метод должен совершить запрос на удаление коллекции без ошибок"
)
require
.
NoError
(
t
,
err
,
"Метод должен совершить запрос на удаление коллекции без ошибок"
)
...
@@ -189,7 +189,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
...
@@ -189,7 +189,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
})
})
t
.
Run
(
"DeleteFn return false"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"DeleteFn return false"
,
func
(
t
*
testing
.
T
)
{
setup
:=
NewSetup
(
nil
,
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
:=
NewSetup
(
nil
,
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollectionIfRemove
())
_
,
_
=
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollectionIfRemove
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
@@ -197,7 +197,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
...
@@ -197,7 +197,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
})
})
t
.
Run
(
"DeleteFn return err"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"DeleteFn return err"
,
func
(
t
*
testing
.
T
)
{
setup
:=
NewSetup
(
nil
,
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
:=
NewSetup
(
nil
,
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
func
(
c
*
CollectionConfig
)
{
_
,
_
=
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
func
(
c
*
CollectionConfig
)
{
c
.
DeleteFn
=
func
(
_
*
Setup
,
_
*
collections
.
Collection
)
(
bool
,
error
)
{
return
false
,
errors
.
New
(
"some err"
)
}
c
.
DeleteFn
=
func
(
_
*
Setup
,
_
*
collections
.
Collection
)
(
bool
,
error
)
{
return
false
,
errors
.
New
(
"some err"
)
}
})
})
...
@@ -210,7 +210,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
...
@@ -210,7 +210,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
errors
.
New
(
"some err"
))
.
Once
()
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
errors
.
New
(
"some err"
))
.
Once
()
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
_
,
_
=
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
require
.
ErrorContains
(
t
,
err
,
"some err"
,
"Метод должен возвращать ошибку, возникшую при удалении коллекции"
)
require
.
ErrorContains
(
t
,
err
,
"some err"
,
"Метод должен возвращать ошибку, возникшую при удалении коллекции"
)
...
@@ -221,7 +221,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
...
@@ -221,7 +221,7 @@ func TestSetup_UninstallCollections(t *testing.T) {
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
collections
.
ErrNotFound
)
.
Once
()
svc
.
On
(
"Delete"
,
mock
.
Anything
,
"sp"
,
"env"
,
"coll"
)
.
Return
(
collections
.
ErrNotFound
)
.
Once
()
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
:=
NewSetup
(
&
content
.
Content
{
Collections
:
svc
},
"sp"
,
"env"
,
nil
)
.
WithRemove
(
false
)
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
_
,
_
=
setup
.
Config
.
AddCollection
(
&
collections
.
Collection
{
ID
:
"coll"
},
DeleteCollection
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
deleted
,
err
:=
setup
.
UninstallCollections
(
context
.
Background
())
require
.
NoError
(
t
,
err
,
"some err"
,
"В случае отсутствия коллекции ошибки быть не должно"
)
require
.
NoError
(
t
,
err
,
"some err"
,
"В случае отсутствия коллекции ошибки быть не должно"
)
...
...
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