github.com/hernad/nomad@v1.6.112/drivers/shared/executor/utils_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package executor
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestUtils_IsolationMode(t *testing.T) {
    13  	private := IsolationModePrivate
    14  	host := IsolationModeHost
    15  	blank := ""
    16  
    17  	for _, tc := range []struct {
    18  		plugin, task, exp string
    19  	}{
    20  		{plugin: private, task: private, exp: private},
    21  		{plugin: private, task: host, exp: host},
    22  		{plugin: private, task: blank, exp: private}, // default to private
    23  
    24  		{plugin: host, task: private, exp: private},
    25  		{plugin: host, task: host, exp: host},
    26  		{plugin: host, task: blank, exp: host}, // default to host
    27  	} {
    28  		result := IsolationMode(tc.plugin, tc.task)
    29  		require.Equal(t, tc.exp, result)
    30  	}
    31  }