mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #113138 from claudiubelu/unittests-skip-gce
unittests: Skip test if not on GCE
This commit is contained in:
commit
c5792ad96b
@ -26,6 +26,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -47,6 +48,12 @@ func createProductNameFile() (string, error) {
|
|||||||
// referenced by gceProductNameFile being removed, which is the opposite of
|
// referenced by gceProductNameFile being removed, which is the opposite of
|
||||||
// the other tests
|
// the other tests
|
||||||
func TestMetadata(t *testing.T) {
|
func TestMetadata(t *testing.T) {
|
||||||
|
// This test requires onGCEVM to return True. On Linux, this can be faked by creating a
|
||||||
|
// Product Name File. But on Windows, onGCEVM makes the following syscall instead:
|
||||||
|
// wmic computersystem get model
|
||||||
|
if runtime.GOOS == "windows" && !onGCEVM() {
|
||||||
|
t.Skip("Skipping test on Windows, not on GCE.")
|
||||||
|
}
|
||||||
var err error
|
var err error
|
||||||
gceProductNameFile, err = createProductNameFile()
|
gceProductNameFile, err = createProductNameFile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user