Skip to content

Commit

Permalink
Make the UT run only manually, disable in CI environment
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilipkumars committed May 31, 2017
1 parent d7cf558 commit 4a68b93
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/util/ipvs/ipvs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,34 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//----------------------------------
//HOW TO RUN TEST: go test -ldflags "-X k8s.io/kubernetes/pkg/util/ipvs.isManualUser=true" -v ./pkg/util/ipvs/
//----------------------------------

package ipvs

import (
_ "fmt"
"net"
"os/user"
"reflect"
"syscall"
"testing"
"os/user"

"github.com/docker/libnetwork/ipvs"
"k8s.io/kubernetes/pkg/util/dbus"
"k8s.io/kubernetes/pkg/util/exec"
)

var isManualUser string

//canRunTest run the test only if the user is root or we are able to initalize IPVS kernel module, otherwise we skip it
func canRunTest(t *testing.T) Interface {

if isManualUser != "true" {
t.Skipf("Can be run only manually, rerun as $go test -ldflags \"-X k8s.io/kubernetes/pkg/util/ipvs.isManualUser=true\" -v ./pkg/util/ipvs/")
}

curuser, err := user.Current()
if err != nil {
t.Errorf("Unable to get current user %v", err)
Expand Down

0 comments on commit 4a68b93

Please sign in to comment.