Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
14cad6f7c3 | ||
|
6f188bd5d4 | ||
|
41832ab19e | ||
|
672e4c07af | ||
|
be53013431 | ||
|
c30fc51b03 | ||
|
b429eaab84 | ||
|
e0104e6d93 | ||
|
7bf9712724 | ||
|
78b0f82918 | ||
|
987aa21883 | ||
|
47ac4f6931 | ||
|
f8aa7a43b8 |
@@ -120,6 +120,7 @@ Environment="FLANNELD_ETCD_PREFIX=/coreos.com/network2"
|
|||||||
```
|
```
|
||||||
|
|
||||||
List of flannel configuration parameters:
|
List of flannel configuration parameters:
|
||||||
|
|
||||||
- **etcd_endpoints**: Comma separated list of etcd endpoints
|
- **etcd_endpoints**: Comma separated list of etcd endpoints
|
||||||
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
|
- **etcd_cafile**: Path to CA file used for TLS communication with etcd
|
||||||
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
|
- **etcd_certfile**: Path to certificate file used for TLS communication with etcd
|
||||||
|
@@ -57,9 +57,9 @@ func checkEncoding(cfg node, report *Report) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
c := f.Child("contents")
|
c := f.Child("content")
|
||||||
if _, err := config.DecodeContent(c.String(), e.String()); err != nil {
|
if _, err := config.DecodeContent(c.String(), e.String()); err != nil {
|
||||||
report.Error(c.line, fmt.Sprintf("contents cannot be decoded as %q", e.String()))
|
report.Error(c.line, fmt.Sprintf("content cannot be decoded as %q", e.String()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,27 +60,27 @@ func TestCheckEncoding(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: aGVsbG8K",
|
config: "write_files:\n - encoding: base64\n content: aGVsbG8K",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - contents: !!binary aGVsbG8K",
|
config: "write_files:\n - content: !!binary aGVsbG8K",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: !!binary aGVsbG8K",
|
config: "write_files:\n - encoding: base64\n content: !!binary aGVsbG8K",
|
||||||
entries: []Entry{{entryError, `contents cannot be decoded as "base64"`, 3}},
|
entries: []Entry{{entryError, `content cannot be decoded as "base64"`, 3}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: base64\n contents: !!binary YUdWc2JHOEsK",
|
config: "write_files:\n - encoding: base64\n content: !!binary YUdWc2JHOEsK",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: gzip\n contents: !!binary H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
config: "write_files:\n - encoding: gzip\n content: !!binary H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: gzip+base64\n contents: H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
config: "write_files:\n - encoding: gzip+base64\n content: H4sIAOC3tVQAA8tIzcnJ5wIAIDA6NgYAAAA=",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
config: "write_files:\n - encoding: custom\n contents: hello",
|
config: "write_files:\n - encoding: custom\n content: hello",
|
||||||
entries: []Entry{{entryError, `contents cannot be decoded as "custom"`, 3}},
|
entries: []Entry{{entryError, `content cannot be decoded as "custom"`, 3}},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version = "1.3.1"
|
version = "1.3.3"
|
||||||
datasourceInterval = 100 * time.Millisecond
|
datasourceInterval = 100 * time.Millisecond
|
||||||
datasourceMaxInterval = 30 * time.Second
|
datasourceMaxInterval = 30 * time.Second
|
||||||
datasourceTimeout = 5 * time.Minute
|
datasourceTimeout = 5 * time.Minute
|
||||||
|
@@ -69,7 +69,9 @@ func (cd *configDrive) FetchMetadata() (metadata datasource.Metadata, err error)
|
|||||||
|
|
||||||
metadata.SSHPublicKeys = m.SSHAuthorizedKeyMap
|
metadata.SSHPublicKeys = m.SSHAuthorizedKeyMap
|
||||||
metadata.Hostname = m.Hostname
|
metadata.Hostname = m.Hostname
|
||||||
|
if m.NetworkConfig.ContentPath != "" {
|
||||||
metadata.NetworkConfig, err = cd.tryReadFile(path.Join(cd.openstackRoot(), m.NetworkConfig.ContentPath))
|
metadata.NetworkConfig, err = cd.tryReadFile(path.Join(cd.openstackRoot(), m.NetworkConfig.ContentPath))
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -31,23 +31,22 @@ func TestFetchMetadata(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
root: "/",
|
root: "/",
|
||||||
files: test.MockFilesystem{"/openstack/latest/meta_data.json": ""},
|
files: test.NewMockFilesystem(test.File{Path: "/openstack/latest/meta_data.json", Contents: ""}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/",
|
root: "/",
|
||||||
files: test.MockFilesystem{"/openstack/latest/meta_data.json": `{"ignore": "me"}`},
|
files: test.NewMockFilesystem(test.File{Path: "/openstack/latest/meta_data.json", Contents: `{"ignore": "me"}`}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/",
|
root: "/",
|
||||||
files: test.MockFilesystem{"/openstack/latest/meta_data.json": `{"hostname": "host"}`},
|
files: test.NewMockFilesystem(test.File{Path: "/openstack/latest/meta_data.json", Contents: `{"hostname": "host"}`}),
|
||||||
metadata: datasource.Metadata{Hostname: "host"},
|
metadata: datasource.Metadata{Hostname: "host"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/media/configdrive",
|
root: "/media/configdrive",
|
||||||
files: test.MockFilesystem{
|
files: test.NewMockFilesystem(test.File{Path: "/media/configdrive/openstack/latest/meta_data.json", Contents: `{"hostname": "host", "network_config": {"content_path": "config_file.json"}, "public_keys":{"1": "key1", "2": "key2"}}`},
|
||||||
"/media/configdrive/openstack/latest/meta_data.json": `{"hostname": "host", "network_config": {"content_path": "config_file.json"}, "public_keys":{"1": "key1", "2": "key2"}}`,
|
test.File{Path: "/media/configdrive/openstack/config_file.json", Contents: "make it work"},
|
||||||
"/media/configdrive/openstack/config_file.json": "make it work",
|
),
|
||||||
},
|
|
||||||
metadata: datasource.Metadata{
|
metadata: datasource.Metadata{
|
||||||
Hostname: "host",
|
Hostname: "host",
|
||||||
NetworkConfig: []byte("make it work"),
|
NetworkConfig: []byte("make it work"),
|
||||||
@@ -61,10 +60,10 @@ func TestFetchMetadata(t *testing.T) {
|
|||||||
cd := configDrive{tt.root, tt.files.ReadFile}
|
cd := configDrive{tt.root, tt.files.ReadFile}
|
||||||
metadata, err := cd.FetchMetadata()
|
metadata, err := cd.FetchMetadata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("bad error for %q: want %v, got %q", tt, nil, err)
|
t.Fatalf("bad error for %+v: want %v, got %q", tt, nil, err)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(tt.metadata, metadata) {
|
if !reflect.DeepEqual(tt.metadata, metadata) {
|
||||||
t.Fatalf("bad metadata for %q: want %#v, got %#v", tt, tt.metadata, metadata)
|
t.Fatalf("bad metadata for %+v: want %#v, got %#v", tt, tt.metadata, metadata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,27 +77,27 @@ func TestFetchUserdata(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"/",
|
"/",
|
||||||
test.MockFilesystem{},
|
test.NewMockFilesystem(),
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/",
|
"/",
|
||||||
test.MockFilesystem{"/openstack/latest/user_data": "userdata"},
|
test.NewMockFilesystem(test.File{Path: "/openstack/latest/user_data", Contents: "userdata"}),
|
||||||
"userdata",
|
"userdata",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/media/configdrive",
|
"/media/configdrive",
|
||||||
test.MockFilesystem{"/media/configdrive/openstack/latest/user_data": "userdata"},
|
test.NewMockFilesystem(test.File{Path: "/media/configdrive/openstack/latest/user_data", Contents: "userdata"}),
|
||||||
"userdata",
|
"userdata",
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
cd := configDrive{tt.root, tt.files.ReadFile}
|
cd := configDrive{tt.root, tt.files.ReadFile}
|
||||||
userdata, err := cd.FetchUserdata()
|
userdata, err := cd.FetchUserdata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("bad error for %q: want %v, got %q", tt, nil, err)
|
t.Fatalf("bad error for %+v: want %v, got %q", tt, nil, err)
|
||||||
}
|
}
|
||||||
if string(userdata) != tt.userdata {
|
if string(userdata) != tt.userdata {
|
||||||
t.Fatalf("bad userdata for %q: want %q, got %q", tt, tt.userdata, userdata)
|
t.Fatalf("bad userdata for %+v: want %q, got %q", tt, tt.userdata, userdata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,9 @@ func (scs *serverContextService) FetchMetadata() (metadata datasource.Metadata,
|
|||||||
}
|
}
|
||||||
|
|
||||||
metadata.SSHPublicKeys = map[string]string{}
|
metadata.SSHPublicKeys = map[string]string{}
|
||||||
if key, ok := inputMetadata.Meta["ssh_public_key"]; ok {
|
// CloudSigma uses an empty string, rather than no string,
|
||||||
|
// to represent the lack of a SSH key
|
||||||
|
if key, _ := inputMetadata.Meta["ssh_public_key"]; len(key) > 0 {
|
||||||
splitted := strings.Split(key, " ")
|
splitted := strings.Split(key, " ")
|
||||||
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key
|
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,27 @@ func (f *fakeCepgoClient) FetchRaw(key string) ([]byte, error) {
|
|||||||
return f.raw, f.err
|
return f.raw, f.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestServerContextWithEmptyPublicSSHKey(t *testing.T) {
|
||||||
|
client := new(fakeCepgoClient)
|
||||||
|
scs := NewServerContextService()
|
||||||
|
scs.client = client
|
||||||
|
client.raw = []byte(`{
|
||||||
|
"meta": {
|
||||||
|
"base64_fields": "cloudinit-user-data",
|
||||||
|
"cloudinit-user-data": "I2Nsb3VkLWNvbmZpZwoKaG9zdG5hbWU6IGNvcmVvczE=",
|
||||||
|
"ssh_public_key": ""
|
||||||
|
}
|
||||||
|
}`)
|
||||||
|
metadata, err := scs.FetchMetadata()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(metadata.SSHPublicKeys) != 0 {
|
||||||
|
t.Error("There should be no Public SSH Keys provided")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestServerContextFetchMetadata(t *testing.T) {
|
func TestServerContextFetchMetadata(t *testing.T) {
|
||||||
client := new(fakeCepgoClient)
|
client := new(fakeCepgoClient)
|
||||||
scs := NewServerContextService()
|
scs := NewServerContextService()
|
||||||
|
57
datasource/test/filesystem.go
Normal file
57
datasource/test/filesystem.go
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// Copyright 2015 CoreOS, Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockFilesystem map[string]File
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
Path string
|
||||||
|
Contents string
|
||||||
|
Directory bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m MockFilesystem) ReadFile(filename string) ([]byte, error) {
|
||||||
|
if f, ok := m[path.Clean(filename)]; ok {
|
||||||
|
if f.Directory {
|
||||||
|
return nil, fmt.Errorf("read %s: is a directory", filename)
|
||||||
|
}
|
||||||
|
return []byte(f.Contents), nil
|
||||||
|
}
|
||||||
|
return nil, os.ErrNotExist
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMockFilesystem(files ...File) MockFilesystem {
|
||||||
|
fs := MockFilesystem{}
|
||||||
|
for _, file := range files {
|
||||||
|
fs[file.Path] = file
|
||||||
|
|
||||||
|
// Create the directories leading up to the file
|
||||||
|
p := path.Dir(file.Path)
|
||||||
|
for p != "/" && p != "." {
|
||||||
|
if f, ok := fs[p]; ok && !f.Directory {
|
||||||
|
panic(fmt.Sprintf("%q already exists and is not a directory (%#v)", p, f))
|
||||||
|
}
|
||||||
|
fs[p] = File{Path: p, Directory: true}
|
||||||
|
p = path.Dir(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fs
|
||||||
|
}
|
115
datasource/test/filesystem_test.go
Normal file
115
datasource/test/filesystem_test.go
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
// Copyright 2015 CoreOS, Inc.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"os"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestReadFile(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
filesystem MockFilesystem
|
||||||
|
|
||||||
|
filename string
|
||||||
|
contents string
|
||||||
|
err error
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
filename: "dne",
|
||||||
|
err: os.ErrNotExist,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"exists": File{Contents: "hi"},
|
||||||
|
},
|
||||||
|
filename: "exists",
|
||||||
|
contents: "hi",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"dir": File{Directory: true},
|
||||||
|
},
|
||||||
|
filename: "dir",
|
||||||
|
err: errors.New("read dir: is a directory"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tt := range tests {
|
||||||
|
contents, err := tt.filesystem.ReadFile(tt.filename)
|
||||||
|
if tt.contents != string(contents) {
|
||||||
|
t.Errorf("bad contents (test %d): want %q, got %q", i, tt.contents, string(contents))
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(tt.err, err) {
|
||||||
|
t.Errorf("bad error (test %d): want %v, got %v", i, tt.err, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNewMockFilesystem(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
files []File
|
||||||
|
|
||||||
|
filesystem MockFilesystem
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
filesystem: MockFilesystem{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: []File{File{Path: "file"}},
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"file": File{Path: "file"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: []File{File{Path: "/file"}},
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"/file": File{Path: "/file"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: []File{File{Path: "/dir/file"}},
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"/dir": File{Path: "/dir", Directory: true},
|
||||||
|
"/dir/file": File{Path: "/dir/file"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: []File{File{Path: "/dir/dir/file"}},
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"/dir": File{Path: "/dir", Directory: true},
|
||||||
|
"/dir/dir": File{Path: "/dir/dir", Directory: true},
|
||||||
|
"/dir/dir/file": File{Path: "/dir/dir/file"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: []File{File{Path: "/dir/dir/dir", Directory: true}},
|
||||||
|
filesystem: MockFilesystem{
|
||||||
|
"/dir": File{Path: "/dir", Directory: true},
|
||||||
|
"/dir/dir": File{Path: "/dir/dir", Directory: true},
|
||||||
|
"/dir/dir/dir": File{Path: "/dir/dir/dir", Directory: true},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, tt := range tests {
|
||||||
|
filesystem := NewMockFilesystem(tt.files...)
|
||||||
|
if !reflect.DeepEqual(tt.filesystem, filesystem) {
|
||||||
|
t.Errorf("bad filesystem (test %d): want %#v, got %#v", i, tt.filesystem, filesystem)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,28 +0,0 @@
|
|||||||
// Copyright 2015 CoreOS, Inc.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MockFilesystem map[string]string
|
|
||||||
|
|
||||||
func (m MockFilesystem) ReadFile(filename string) ([]byte, error) {
|
|
||||||
if contents, ok := m[filename]; ok {
|
|
||||||
return []byte(contents), nil
|
|
||||||
}
|
|
||||||
return nil, os.ErrNotExist
|
|
||||||
}
|
|
@@ -31,19 +31,19 @@ func TestFetchMetadata(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
root: "/",
|
root: "/",
|
||||||
files: test.MockFilesystem{},
|
files: test.NewMockFilesystem(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/",
|
root: "/",
|
||||||
files: test.MockFilesystem{"/SharedConfig.xml": ""},
|
files: test.NewMockFilesystem(test.File{Path: "/SharedConfig.xml", Contents: ""}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/var/lib/waagent",
|
root: "/var/lib/waagent",
|
||||||
files: test.MockFilesystem{"/var/lib/waagent/SharedConfig.xml": ""},
|
files: test.NewMockFilesystem(test.File{Path: "/var/lib/waagent/SharedConfig.xml", Contents: ""}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
root: "/var/lib/waagent",
|
root: "/var/lib/waagent",
|
||||||
files: test.MockFilesystem{"/var/lib/waagent/SharedConfig.xml": `<?xml version="1.0" encoding="utf-8"?>
|
files: test.NewMockFilesystem(test.File{Path: "/var/lib/waagent/SharedConfig.xml", Contents: `<?xml version="1.0" encoding="utf-8"?>
|
||||||
<SharedConfig version="1.0.0.0" goalStateIncarnation="1">
|
<SharedConfig version="1.0.0.0" goalStateIncarnation="1">
|
||||||
<Deployment name="c8f9e4c9c18948e1bebf57c5685da756" guid="{1d10394f-c741-4a1a-a6bb-278f213c5a5e}" incarnation="0" isNonCancellableTopologyChangeEnabled="false">
|
<Deployment name="c8f9e4c9c18948e1bebf57c5685da756" guid="{1d10394f-c741-4a1a-a6bb-278f213c5a5e}" incarnation="0" isNonCancellableTopologyChangeEnabled="false">
|
||||||
<Service name="core-test-1" guid="{00000000-0000-0000-0000-000000000000}" />
|
<Service name="core-test-1" guid="{00000000-0000-0000-0000-000000000000}" />
|
||||||
@@ -79,7 +79,7 @@ func TestFetchMetadata(t *testing.T) {
|
|||||||
</InputEndpoints>
|
</InputEndpoints>
|
||||||
</Instance>
|
</Instance>
|
||||||
</Instances>
|
</Instances>
|
||||||
</SharedConfig>`},
|
</SharedConfig>`}),
|
||||||
metadata: datasource.Metadata{
|
metadata: datasource.Metadata{
|
||||||
PrivateIPv4: net.ParseIP("100.73.202.64"),
|
PrivateIPv4: net.ParseIP("100.73.202.64"),
|
||||||
PublicIPv4: net.ParseIP("191.239.39.77"),
|
PublicIPv4: net.ParseIP("191.239.39.77"),
|
||||||
@@ -89,10 +89,10 @@ func TestFetchMetadata(t *testing.T) {
|
|||||||
a := waagent{tt.root, tt.files.ReadFile}
|
a := waagent{tt.root, tt.files.ReadFile}
|
||||||
metadata, err := a.FetchMetadata()
|
metadata, err := a.FetchMetadata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("bad error for %q: want %v, got %q", tt, nil, err)
|
t.Fatalf("bad error for %+v: want %v, got %q", tt, nil, err)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(tt.metadata, metadata) {
|
if !reflect.DeepEqual(tt.metadata, metadata) {
|
||||||
t.Fatalf("bad metadata for %q: want %#v, got %#v", tt, tt.metadata, metadata)
|
t.Fatalf("bad metadata for %+v: want %#v, got %#v", tt, tt.metadata, metadata)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,21 +104,21 @@ func TestFetchUserdata(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"/",
|
"/",
|
||||||
test.MockFilesystem{},
|
test.NewMockFilesystem(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/",
|
"/",
|
||||||
test.MockFilesystem{"/CustomData": ""},
|
test.NewMockFilesystem(test.File{Path: "/CustomData", Contents: ""}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/var/lib/waagent/",
|
"/var/lib/waagent/",
|
||||||
test.MockFilesystem{"/var/lib/waagent/CustomData": ""},
|
test.NewMockFilesystem(test.File{Path: "/var/lib/waagent/CustomData", Contents: ""}),
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
a := waagent{tt.root, tt.files.ReadFile}
|
a := waagent{tt.root, tt.files.ReadFile}
|
||||||
_, err := a.FetchUserdata()
|
_, err := a.FetchUserdata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("bad error for %q: want %v, got %q", tt, nil, err)
|
t.Fatalf("bad error for %+v: want %v, got %q", tt, nil, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
test
1
test
@@ -24,6 +24,7 @@ declare -a TESTPKGS=(
|
|||||||
datasource/metadata/digitalocean
|
datasource/metadata/digitalocean
|
||||||
datasource/metadata/ec2
|
datasource/metadata/ec2
|
||||||
datasource/proc_cmdline
|
datasource/proc_cmdline
|
||||||
|
datasource/test
|
||||||
datasource/url
|
datasource/url
|
||||||
datasource/waagent
|
datasource/waagent
|
||||||
initialize
|
initialize
|
||||||
|
Reference in New Issue
Block a user