cleans up comments, adds short testing options to more tests
This commit is contained in:
parent
54b77122a5
commit
125e4771dd
@ -72,21 +72,3 @@ func TestErrorFuncs(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// /* Run these tests only as a user */
|
||||
//
|
||||
// // fail to reload system daemon as user
|
||||
// {"", ErrInsufficientPermissions, Options{UserMode: false}, true},
|
||||
// // reload user's scope daemon
|
||||
// {"", nil, Options{UserMode: true}, true},
|
||||
// /* End user tests*/
|
||||
//
|
||||
// /* Run these tests only as a superuser */
|
||||
//
|
||||
// // succeed to reload daemon
|
||||
// {"", nil, Options{UserMode: false}, false},
|
||||
// // fail to connect to user bus as system
|
||||
// {"", ErrBusFailure, Options{UserMode: true}, false},
|
||||
//
|
||||
// /* End superuser tests*/
|
||||
//
|
||||
|
@ -17,6 +17,9 @@ import (
|
||||
// - your user doesn't have a PolKit rule allowing access to configure nginx
|
||||
|
||||
func TestGetStartTime(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
testCases := []struct {
|
||||
unit string
|
||||
err error
|
||||
@ -132,6 +135,9 @@ func TestGetNumRestarts(t *testing.T) {
|
||||
}
|
||||
// Prove restart count increases by one after a restart
|
||||
t.Run(fmt.Sprintf("prove restart count increases by one after a restart"), func(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
if userString != "root" && userString != "system" {
|
||||
t.Skip("skipping superuser test while running as user")
|
||||
}
|
||||
@ -268,6 +274,9 @@ func TestGetPID(t *testing.T) {
|
||||
})
|
||||
}
|
||||
t.Run(fmt.Sprintf("prove pid changes"), func(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
if userString != "root" && userString != "system" {
|
||||
t.Skip("skipping superuser test while running as user")
|
||||
}
|
||||
|
@ -147,6 +147,9 @@ func ExampleEnable() {
|
||||
func TestIsActive(t *testing.T) {
|
||||
unit := "nginx"
|
||||
t.Run(fmt.Sprintf("check active"), func(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
if userString != "root" && userString != "system" {
|
||||
t.Skip("skipping superuser test while running as user")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user