[ARVADOS] updated: 1.3.0-398-g69f077567

Git user git at public.curoverse.com
Thu Feb 28 10:35:25 EST 2019


Summary of changes:
 lib/cloud/ec2/ec2.go      | 10 +++++++++-
 lib/cloud/ec2/ec2_test.go | 29 +++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

       via  69f07756764e4722084aec1a7f9bcd005d4b1d04 (commit)
      from  6f52f5f4152b194aede8e9c8b05d210a9ba7718a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 69f07756764e4722084aec1a7f9bcd005d4b1d04
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Thu Feb 28 10:35:00 2019 -0500

    14291: minimal stub so that tests don't panic when run without live config
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/cloud/ec2/ec2.go b/lib/cloud/ec2/ec2.go
index dab708c8d..9b75abe09 100644
--- a/lib/cloud/ec2/ec2.go
+++ b/lib/cloud/ec2/ec2.go
@@ -37,11 +37,19 @@ type ec2InstanceSetConfig struct {
 	KeyPairName     string
 }
 
+type EC2Interface interface {
+	ImportKeyPair(input *ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error)
+	RunInstances(input *ec2.RunInstancesInput) (*ec2.Reservation, error)
+	DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error)
+	CreateTags(input *ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error)
+	TerminateInstances(input *ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error)
+}
+
 type ec2InstanceSet struct {
 	ec2config    ec2InstanceSetConfig
 	dispatcherID cloud.InstanceSetID
 	logger       logrus.FieldLogger
-	client       *ec2.EC2
+	client       EC2Interface
 	importedKey  bool
 }
 
diff --git a/lib/cloud/ec2/ec2_test.go b/lib/cloud/ec2/ec2_test.go
index e76ec724c..868de0956 100644
--- a/lib/cloud/ec2/ec2_test.go
+++ b/lib/cloud/ec2/ec2_test.go
@@ -32,6 +32,8 @@ import (
 	"git.curoverse.com/arvados.git/lib/cloud"
 	"git.curoverse.com/arvados.git/sdk/go/arvados"
 	"git.curoverse.com/arvados.git/sdk/go/config"
+	"github.com/aws/aws-sdk-go/aws"
+	"github.com/aws/aws-sdk-go/service/ec2"
 	"github.com/sirupsen/logrus"
 	"golang.org/x/crypto/ssh"
 	check "gopkg.in/check.v1"
@@ -53,6 +55,32 @@ type testConfig struct {
 	DriverParameters    json.RawMessage
 }
 
+type ec2stub struct {
+}
+
+func (e *ec2stub) ImportKeyPair(input *ec2.ImportKeyPairInput) (*ec2.ImportKeyPairOutput, error) {
+	return nil, nil
+}
+
+func (e *ec2stub) RunInstances(input *ec2.RunInstancesInput) (*ec2.Reservation, error) {
+	return &ec2.Reservation{Instances: []*ec2.Instance{&ec2.Instance{
+		InstanceId: aws.String("i-123"),
+		Tags:       input.TagSpecifications[0].Tags,
+	}}}, nil
+}
+
+func (e *ec2stub) DescribeInstances(input *ec2.DescribeInstancesInput) (*ec2.DescribeInstancesOutput, error) {
+	return &ec2.DescribeInstancesOutput{}, nil
+}
+
+func (e *ec2stub) CreateTags(input *ec2.CreateTagsInput) (*ec2.CreateTagsOutput, error) {
+	return nil, nil
+}
+
+func (e *ec2stub) TerminateInstances(input *ec2.TerminateInstancesInput) (*ec2.TerminateInstancesOutput, error) {
+	return nil, nil
+}
+
 func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error) {
 	cluster := arvados.Cluster{
 		InstanceTypes: arvados.InstanceTypeMap(map[string]arvados.InstanceType{
@@ -99,6 +127,7 @@ func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error)
 		ec2config:    ec2InstanceSetConfig{},
 		dispatcherID: "test123",
 		logger:       logrus.StandardLogger(),
+		client:       &ec2stub{},
 	}
 	return &ap, cloud.ImageID("blob"), cluster, nil
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list