github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/monitor/extractors/error_test.go (about)

     1  package extractors
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	. "github.com/smartystreets/goconvey/convey"
     8  )
     9  
    10  func TestErrors(t *testing.T) {
    11  	Convey("Testing ErrNetclsAlreadyProgrammed handling functions", t, func() {
    12  		err := ErrNetclsAlreadyProgrammed("mark")
    13  		So(err, ShouldNotBeNil)
    14  
    15  		expected := fmt.Sprintf("net_cls cgroup already programmed with mark %s", "mark")
    16  		So(err.Error(), ShouldEqual, expected)
    17  
    18  		So(IsErrNetclsAlreadyProgrammed(err), ShouldBeTrue)
    19  		So(IsErrNetclsAlreadyProgrammed(ErrNoHostNetworkPod), ShouldBeFalse)
    20  	})
    21  	Convey("Testing ErrNoHostNetworkPod handling functions", t, func() {
    22  		So(IsErrNoHostNetworkPod(ErrNoHostNetworkPod), ShouldBeTrue)
    23  		So(IsErrNoHostNetworkPod(fmt.Errorf("random")), ShouldBeFalse)
    24  	})
    25  }