Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Distributed Computing and Network Fusion System
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WirelessInformationCollaborate
Distributed Computing and Network Fusion System
Commits
318e4a90
Commit
318e4a90
authored
Jun 22, 2020
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix utils tests bug
parent
a9800d93
Pipeline
#13
passed with stage
in 0 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
77 deletions
+26
-77
cnf-utils/src/main/java/top/ninwoo/utils/config/UtilsProperties.java
...rc/main/java/top/ninwoo/utils/config/UtilsProperties.java
+1
-1
cnf-utils/src/main/resources/META-INF/spring.factories
cnf-utils/src/main/resources/META-INF/spring.factories
+0
-2
cnf-utils/src/test/java/top/ninwoo/utils/DockerUtilsTest.java
...utils/src/test/java/top/ninwoo/utils/DockerUtilsTest.java
+24
-3
cnf-utils/src/test/java/top/ninwoo/utils/EntityTests.java
cnf-utils/src/test/java/top/ninwoo/utils/EntityTests.java
+0
-9
cnf-utils/src/test/java/top/ninwoo/utils/IptablesServiceTests.java
.../src/test/java/top/ninwoo/utils/IptablesServiceTests.java
+0
-21
cnf-utils/src/test/java/top/ninwoo/utils/OsUtilsTests.java
cnf-utils/src/test/java/top/ninwoo/utils/OsUtilsTests.java
+1
-1
cnf-utils/src/test/java/top/ninwoo/utils/SpringMain.java
cnf-utils/src/test/java/top/ninwoo/utils/SpringMain.java
+0
-12
cnf-utils/src/test/java/top/ninwoo/utils/TcUtilsTests.java
cnf-utils/src/test/java/top/ninwoo/utils/TcUtilsTests.java
+0
-28
No files found.
cnf-utils/src/main/java/top/ninwoo/utils/config/UtilsProperties.java
View file @
318e4a90
...
...
@@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties
(
prefix
=
"cnf.utils"
)
public
class
UtilsProperties
{
private
String
passwd
=
"
admin
"
;
private
String
passwd
=
"
Vudo3423
"
;
public
String
getPasswd
()
{
return
passwd
;
...
...
cnf-utils/src/main/resources/META-INF/spring.factories
deleted
100644 → 0
View file @
a9800d93
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
top.ninwoo.utils.config.CNFUtilsAutoConfiguration
\ No newline at end of file
cnf-utils/src/test/java/top/ninwoo/utils/DockerUtilsTest.java
View file @
318e4a90
package
top.ninwoo.utils
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -10,6 +12,9 @@ import top.ninwoo.common.entity.DockerContainer;
import
top.ninwoo.utils.config.CNFUtilsAutoConfiguration
;
import
top.ninwoo.utils.util.DockerUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @Author joliu
* @Description
...
...
@@ -18,13 +23,23 @@ import top.ninwoo.utils.util.DockerUtils;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
CNFUtilsAutoConfiguration
.
class
)
public
class
DockerUtilsTest
{
private
static
String
cid
=
null
;
@Autowired
DockerUtils
dockerUtils
;
@Before
public
void
prepare
()
{
DockerContainer
container
=
new
DockerContainer
();
container
.
setName
(
"Router_4"
);
container
.
setImage
(
"joliu/networktest"
);
container
.
setCommand
(
"sh"
);
cid
=
dockerUtils
.
runDocker
(
container
).
getId
();
}
@Test
public
void
testGetDockerById
()
{
DockerContainer
dockerById
=
dockerUtils
.
getDockerById
(
"123123"
);
Assert
.
is
Null
(
dockerById
);
DockerContainer
dockerById
=
dockerUtils
.
getDockerById
(
cid
);
Assert
.
is
True
(
dockerById
!=
null
);
}
...
...
@@ -32,6 +47,12 @@ public class DockerUtilsTest {
public
void
testExecInDocker
()
{
final
String
s
=
dockerUtils
.
execInDocker
(
"Router_4"
,
new
String
[]{
"ifconfig"
});
System
.
out
.
println
(
s
);
Assert
.
isTrue
(!(
""
.
equals
(
s
)));
}
@After
public
void
close
()
{
boolean
result
=
dockerUtils
.
deleteDockerById
(
cid
);
Assert
.
isTrue
(
result
);
}
}
cnf-utils/src/test/java/top/ninwoo/utils/EntityTests.java
deleted
100644 → 0
View file @
a9800d93
package
top.ninwoo.utils
;
/**
* @Author joliu
* @Description
* @Date Create in 下午10:50 2019/10/27
*/
public
class
EntityTests
{
}
cnf-utils/src/test/java/top/ninwoo/utils/IptablesServiceTests.java
deleted
100644 → 0
View file @
a9800d93
package
top.ninwoo.utils
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
top.ninwoo.utils.config.CNFUtilsAutoConfiguration
;
import
top.ninwoo.utils.service.IptablesService
;
/**
* @Author joliu
* @Description
* @Date Create in 下午3:15 2019/10/30
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
CNFUtilsAutoConfiguration
.
class
)
public
class
IptablesServiceTests
{
@Autowired
IptablesService
iptablesService
;
}
cnf-utils/src/test/java/top/ninwoo/utils/OsUtilsTests.java
View file @
318e4a90
...
...
@@ -26,7 +26,7 @@ public class OsUtilsTests {
System
.
out
.
println
(
"CPU:"
+
osUtils
.
cpuUsage
()
+
"%"
);
System
.
out
.
println
(
"MEM:"
+
osUtils
.
memoryUsage
()
+
"%"
);
int
i
=
0
;
while
(
i
<
10
)
{
while
(
i
++
<
10
)
{
System
.
out
.
println
(
"NET:"
+
osUtils
.
networkUsage
()
+
"%"
);
}
}
...
...
cnf-utils/src/test/java/top/ninwoo/utils/SpringMain.java
deleted
100644 → 0
View file @
a9800d93
package
top.ninwoo.utils
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
top.ninwoo.utils.config.CNFUtilsAutoConfiguration
;
public
class
SpringMain
{
public
static
void
main
(
String
[]
args
)
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
CNFUtilsAutoConfiguration
.
class
);
}
}
cnf-utils/src/test/java/top/ninwoo/utils/TcUtilsTests.java
deleted
100644 → 0
View file @
a9800d93
package
top.ninwoo.utils
;
import
org.junit.Before
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
top.ninwoo.utils.config.CNFUtilsAutoConfiguration
;
import
top.ninwoo.utils.util.DockerUtils
;
/**
* @Author joliu
* @Description 这个测试迁移到集群服务中
* @Date Create in 下午4:06 2019/10/30
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
classes
=
CNFUtilsAutoConfiguration
.
class
)
public
class
TcUtilsTests
{
@Autowired
DockerUtils
dockerUtils
;
@Before
public
void
init
()
{
// 创建两个容器
// 创建一个ovs网桥
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment