github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/no_proxy_test.go (about)

     1  // Copyright (c) 2017 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package virtcontainers
     7  
     8  import (
     9  	"testing"
    10  
    11  	"github.com/stretchr/testify/assert"
    12  )
    13  
    14  func TestNoProxyStart(t *testing.T) {
    15  	p := &noProxy{}
    16  	assert := assert.New(t)
    17  
    18  	agentURL := "agentURL"
    19  	_, _, err := p.start(proxyParams{
    20  		agentURL: agentURL,
    21  	})
    22  	assert.NotNil(err)
    23  
    24  	pid, vmURL, err := p.start(proxyParams{
    25  		agentURL: agentURL,
    26  		logger:   testDefaultLogger,
    27  	})
    28  	assert.Nil(err)
    29  	assert.Equal(vmURL, agentURL)
    30  	assert.Equal(pid, 0)
    31  
    32  	err = p.stop(0)
    33  	assert.Nil(err)
    34  
    35  	assert.False(p.consoleWatched())
    36  }