Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Flight #940

Merged
merged 17 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kola/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (t *TestCluster) Run(name string, f func(c TestCluster)) bool {

// RunNative runs a registered NativeFunc on a remote machine
func (t *TestCluster) RunNative(funcName string, m platform.Machine) bool {
command := fmt.Sprintf("./kolet run %q %q", t.Name(), funcName)
command := fmt.Sprintf("./kolet run %q %q", t.H.Name(), funcName)
return t.Run(funcName, func(c TestCluster) {
client, err := m.SSHClient()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/ignition/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func init() {
func resourceLocal(c cluster.TestCluster) {
server := c.Machines()[0]

c.MustSSH(server, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s Serve", c.Name()))
c.MustSSH(server, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s Serve", c.H.Name()))

ip := server.PrivateIP()
if c.Platform() == packet.Platform {
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/ignition/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ EOF
) -extensions SAN'`, "$IP", ip, -1))
publicKey := c.MustSSH(server, "sudo cat /var/tls/server.crt")

c.MustSSH(server, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s TLSServe", c.Name()))
c.MustSSH(server, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s TLSServe", c.H.Name()))

client, err := c.NewMachine(localSecurityClient.Subst("$IP", ip).Subst("$KEY", dataurl.EncodeBytes(publicKey)))
if err != nil {
Expand Down
11 changes: 10 additions & 1 deletion kola/tests/kubernetes/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ type kCluster struct {
workers []platform.Machine
}

// resolve ambiguity with TestCluster.Name()
type clusterWrapper struct {
bgilbert marked this conversation as resolved.
Show resolved Hide resolved
*cluster.TestCluster
}

func (cw clusterWrapper) Name() string {
return cw.Cluster.Name()
}

// Setup a multi-node cluster based on generic scrips from coreos-kubernetes repo.
// https://github.com/coreos/coreos-kubernetes/tree/master/multi-node/generic
func setupCluster(c cluster.TestCluster, nodes int, version, runtime string) *kCluster {
Expand Down Expand Up @@ -73,7 +82,7 @@ func setupCluster(c cluster.TestCluster, nodes int, version, runtime string) *kC
}

// create worker nodes
workers, err := platform.NewMachines(c, conf.CloudConfig(""), nodes)
workers, err := platform.NewMachines(clusterWrapper{&c}, conf.CloudConfig(""), nodes)
bgilbert marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
c.Fatalf("error creating workers: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion kola/tests/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func configureOmahaServer(c cluster.TestCluster, srv platform.Machine) string {
c.Fatalf("copying update payload to omaha server: %v", err)
}

c.MustSSH(srv, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s Omaha", c.Name()))
c.MustSSH(srv, fmt.Sprintf("sudo systemd-run --quiet ./kolet run %s Omaha", c.H.Name()))

err = util.WaitUntilReady(60*time.Second, 5*time.Second, func() (bool, error) {
_, _, err := srv.SSH(fmt.Sprintf("curl %s:34567", srv.PrivateIP()))
Expand Down
5 changes: 0 additions & 5 deletions platform/base.go → platform/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"sync"
"time"

"github.com/coreos/pkg/capnslog"
"github.com/satori/go.uuid"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/agent"
Expand All @@ -32,10 +31,6 @@ import (
"github.com/coreos/mantle/util"
)

var (
plog = capnslog.NewPackageLogger("github.com/coreos/mantle", "platform")
)

type BaseCluster struct {
agent *network.SSHAgent

Expand Down
8 changes: 8 additions & 0 deletions platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"sync"
"time"

"github.com/coreos/pkg/capnslog"
"golang.org/x/crypto/ssh"
"golang.org/x/net/context"

Expand All @@ -34,6 +35,10 @@ const (
sshTimeout = 10 * time.Second
)

var (
plog = capnslog.NewPackageLogger("github.com/coreos/mantle", "platform")
)

// Name is a unique identifier for a platform.
type Name string

Expand Down Expand Up @@ -81,6 +86,9 @@ type Cluster interface {
// Platform returns the name of the platform.
Platform() Name

// Name returns a unique name for the Cluster.
Name() string

// NewMachine creates a new Container Linux machine.
NewMachine(userdata *conf.UserData) (Machine, error)

Expand Down