Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
3ecffc7b
Commit
3ecffc7b
authored
4 years ago
by
tiecheng
Browse files
Options
Downloads
Patches
Plain Diff
update config_center file test
parent
f3ce3a3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
config_center/file/impl_test.go
+14
-16
14 additions, 16 deletions
config_center/file/impl_test.go
with
14 additions
and
16 deletions
config_center/file/impl_test.go
+
14
−
16
View file @
3ecffc7b
...
...
@@ -52,15 +52,14 @@ func initFileData(t *testing.T) (*FileSystemDynamicConfiguration, error) {
func
TestPublishAndGetConfig
(
t
*
testing
.
T
)
{
file
,
err
:=
initFileData
(
t
)
assert
.
NoError
(
t
,
err
)
if
err
:=
file
.
PublishConfig
(
key
,
""
,
"A"
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
err
=
file
.
PublishConfig
(
key
,
""
,
"A"
)
assert
.
NoError
(
t
,
err
)
if
prop
,
err
:=
file
.
GetProperties
(
key
)
;
err
!=
nil
{
assert
.
Equal
(
t
,
"A"
,
prop
)
}
prop
,
err
:=
file
.
GetProperties
(
key
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
"A"
,
prop
)
defer
destroy
(
t
,
file
.
rootPath
,
file
)
defer
destroy
(
file
.
rootPath
,
file
)
}
func
TestAddListener
(
t
*
testing
.
T
)
{
...
...
@@ -86,7 +85,7 @@ func TestAddListener(t *testing.T) {
listener
.
wg
.
Wait
()
time
.
Sleep
(
time
.
Second
)
defer
destroy
(
t
,
file
.
rootPath
,
file
)
defer
destroy
(
file
.
rootPath
,
file
)
}
func
TestAddAndRemoveListener
(
t
*
testing
.
T
)
{
...
...
@@ -117,7 +116,7 @@ func TestAddAndRemoveListener(t *testing.T) {
listener
.
wg
.
Wait
()
time
.
Sleep
(
time
.
Second
)
defer
destroy
(
t
,
file
.
rootPath
,
file
)
defer
destroy
(
file
.
rootPath
,
file
)
}
func
TestGetConfigKeysByGroup
(
t
*
testing
.
T
)
{
...
...
@@ -128,7 +127,8 @@ func TestGetConfigKeysByGroup(t *testing.T) {
gs
,
err
:=
file
.
GetConfigKeysByGroup
(
group
)
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
1
,
gs
.
Size
())
defer
destroy
(
t
,
file
.
rootPath
,
file
)
assert
.
Equal
(
t
,
key
,
gs
.
Values
()[
0
])
defer
destroy
(
file
.
rootPath
,
file
)
}
func
TestGetConfig
(
t
*
testing
.
T
)
{
...
...
@@ -141,7 +141,7 @@ func TestGetConfig(t *testing.T) {
prop
,
err
:=
file
.
GetProperties
(
key
,
config_center
.
WithGroup
(
group
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
value
,
prop
)
defer
destroy
(
t
,
file
.
rootPath
,
file
)
defer
destroy
(
file
.
rootPath
,
file
)
}
func
TestPublishConfig
(
t
*
testing
.
T
)
{
...
...
@@ -154,13 +154,11 @@ func TestPublishConfig(t *testing.T) {
prop
,
err
:=
file
.
GetInternalProperty
(
key
,
config_center
.
WithGroup
(
group
))
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
value
,
prop
)
defer
destroy
(
t
,
file
.
rootPath
,
file
)
defer
destroy
(
file
.
rootPath
,
file
)
}
func
destroy
(
t
*
testing
.
T
,
path
string
,
fdc
*
FileSystemDynamicConfiguration
)
{
if
err
:=
os
.
RemoveAll
(
path
);
err
!=
nil
{
t
.
Error
(
err
)
}
func
destroy
(
path
string
,
fdc
*
FileSystemDynamicConfiguration
)
{
os
.
RemoveAll
(
path
)
fdc
.
Close
()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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