github.com/coreos/mantle@v0.13.0/kola/tests/misc/install.go (about) 1 // Copyright 2017 CoreOS, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package misc 16 17 import ( 18 "bytes" 19 20 "github.com/coreos/mantle/kola/cluster" 21 "github.com/coreos/mantle/kola/register" 22 "github.com/coreos/mantle/platform/conf" 23 ) 24 25 func init() { 26 register.Register(®ister.Test{ 27 Run: InstallCloudConfig, 28 ClusterSize: 1, 29 Name: "cl.install.cloudinit", 30 UserData: conf.Ignition(`{ 31 "ignition": { "version": "2.0.0" }, 32 "storage": { 33 "files": [{ 34 "filesystem": "root", 35 "path": "/var/lib/coreos-install/user_data", 36 "contents": { "source": "data:,%23cloud-config%0Ahostname:%20%22cloud-config-worked%22" }, 37 "mode": 420 38 }] 39 } 40 }`), 41 Distros: []string{"cl"}, 42 ExcludePlatforms: []string{"azure"}, 43 }) 44 } 45 46 // Simulate coreos-install features 47 48 // Verify that the coreos-install cloud-config path is used 49 func InstallCloudConfig(c cluster.TestCluster) { 50 m := c.Machines()[0] 51 52 // Verify the host name was set from the cloud-config file 53 if output, err := c.SSH(m, "hostname"); err != nil || !bytes.Equal(output, []byte("cloud-config-worked")) { 54 c.Fatalf("hostname: %q: %v", output, err) 55 } 56 }