2019-02-27 13:10:23 +00:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
2020-05-26 13:44:26 +00:00
|
|
|
"context"
|
2019-02-27 13:10:23 +00:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/nomad/client/testutil"
|
|
|
|
"github.com/hashicorp/nomad/helper/testlog"
|
|
|
|
"github.com/hashicorp/nomad/plugins/drivers"
|
|
|
|
tu "github.com/hashicorp/nomad/testutil"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TestDockerDriver_FingerprintHealth asserts that docker reports healthy
|
|
|
|
// whenever Docker is supported.
|
|
|
|
//
|
|
|
|
// In Linux CI and AppVeyor Windows environment, it should be enabled.
|
|
|
|
func TestDockerDriver_FingerprintHealth(t *testing.T) {
|
|
|
|
if !tu.IsCI() {
|
|
|
|
t.Parallel()
|
|
|
|
}
|
|
|
|
testutil.DockerCompatible(t)
|
|
|
|
|
2020-05-26 13:44:26 +00:00
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
d := NewDockerDriver(ctx, testlog.HCLogger(t)).(*Driver)
|
2019-02-27 13:10:23 +00:00
|
|
|
|
|
|
|
fp := d.buildFingerprint()
|
|
|
|
require.Equal(t, drivers.HealthStateHealthy, fp.Health)
|
|
|
|
}
|