github.com/RobustRoundRobin/quorum@v20.10.0+incompatible/internal/build/util_test.go (about)

     1  package build
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	testifyassert "github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestIgnorePackages_whenTypical(t *testing.T) {
    11  	assert := testifyassert.New(t)
    12  
    13  	arbitraryPackages := []string{"abc", "xyz/abc"}
    14  
    15  	actual := IgnorePackages(arbitraryPackages)
    16  
    17  	assert.Equal(arbitraryPackages, actual)
    18  }
    19  
    20  func TestIgnorePackages_whenIgnoreOnePackage(t *testing.T) {
    21  	assert := testifyassert.New(t)
    22  
    23  	arbitraryPackages := []string{"abc", "xyz/abc"}
    24  	assert.NoError(os.Setenv("QUORUM_IGNORE_TEST_PACKAGES", "abc"))
    25  
    26  	actual := IgnorePackages(arbitraryPackages)
    27  
    28  	assert.Equal([]string{arbitraryPackages[1]}, actual)
    29  }
    30  
    31  func TestIgnorePackages_whenIgnorePackages(t *testing.T) {
    32  	assert := testifyassert.New(t)
    33  
    34  	arbitraryPackages := []string{"abc", "xyz/abc/opq"}
    35  	assert.NoError(os.Setenv("QUORUM_IGNORE_TEST_PACKAGES", "abc, xyz/abc"))
    36  
    37  	actual := IgnorePackages(arbitraryPackages)
    38  
    39  	assert.Len(actual, 0)
    40  }