Merge pull request #4366 from hashicorp/b-exec

Disable Exec on non-linux platforms
This commit is contained in:
Alex Dadgar 2018-06-01 22:57:18 +00:00 committed by GitHub
commit b34d8829fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View file

@ -51,6 +51,7 @@ BUG FIXES:
Consul agent [GH-4365]
* driver/docker: Fix docker credential helper support [[GH-4266](https://github.com/hashicorp/nomad/issues/4266)]
* driver/docker: Fix panic when docker client configuration options are invalid [[GH-4303](https://github.com/hashicorp/nomad/issues/4303)]
* driver/exec: Disable exec on non-linux platforms [GH-4366]
* rpc: Fix RPC tunneling when running both client/server on one machine [[GH-4317](https://github.com/hashicorp/nomad/issues/4317)]
* ui: Track the method in XHR tracking to prevent errant ACL error dialogs when stopping a job [[GH-4319](https://github.com/hashicorp/nomad/issues/4319)]
* ui: Use Polling instead of Streaming for logs in Safari [[GH-4335](https://github.com/hashicorp/nomad/issues/4335)]

View file

@ -9,6 +9,6 @@ import (
func (d *ExecDriver) Fingerprint(req *cstructs.FingerprintRequest, resp *cstructs.FingerprintResponse) error {
d.fingerprintSuccess = helper.BoolToPtr(false)
resp.Detected = true
resp.Detected = false
return nil
}

View file

@ -7,6 +7,7 @@ import (
"io/ioutil"
"path/filepath"
"reflect"
"runtime"
"strings"
"testing"
"time"
@ -20,6 +21,30 @@ import (
ctestutils "github.com/hashicorp/nomad/client/testutil"
)
// Test that we do not enable exec on non-linux machines
func TestExecDriver_Fingerprint_NonLinux(t *testing.T) {
if !testutil.IsTravis() {
t.Parallel()
}
if runtime.GOOS == "linux" {
t.Skip("Test only available not on Linux")
}
d := NewExecDriver(&DriverContext{})
node := &structs.Node{}
request := &cstructs.FingerprintRequest{Config: &config.Config{}, Node: node}
var response cstructs.FingerprintResponse
err := d.Fingerprint(request, &response)
if err != nil {
t.Fatalf("err: %v", err)
}
if response.Detected {
t.Fatalf("Should not be detected on non-linux platforms")
}
}
func TestExecDriver_Fingerprint(t *testing.T) {
if !testutil.IsTravis() {
t.Parallel()