github.com/kubernetes-incubator/kube-aws@v0.16.4/pkg/api/etcd_test.go (about)

     1  package api
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestEtcd(t *testing.T) {
     8  	etcdTest := Etcd{
     9  		EC2Instance: EC2Instance{
    10  			Count:        1,
    11  			InstanceType: "t2.medium",
    12  			RootVolume: RootVolume{
    13  				Size: 30,
    14  				Type: "gp2",
    15  				IOPS: 0,
    16  			},
    17  			Tenancy: "default",
    18  		},
    19  		DataVolume: DataVolume{
    20  			Size: 30,
    21  			Type: "gp2",
    22  			IOPS: 0,
    23  		},
    24  		StackExists: false,
    25  		UserSuppliedArgs: UserSuppliedArgs{
    26  			QuotaBackendBytes:       100000000,
    27  			AutoCompactionRetention: 1,
    28  		},
    29  	}
    30  
    31  	if etcdTest.LogicalName() != "Etcd" {
    32  		t.Errorf("logical name incorrect, expected: Etcd, got: %s", etcdTest.LogicalName())
    33  	}
    34  
    35  	if etcdTest.NameTagKey() != "kube-aws:etcd:name" {
    36  		t.Errorf("name tag key incorrect, expected: kube-aws:etcd:name, got: %s", etcdTest.NameTagKey())
    37  	}
    38  
    39  	if !etcdTest.NodeShouldHaveEIP() {
    40  		t.Error("expected: true, got: false")
    41  	}
    42  
    43  	if etcdTest.SecurityGroupRefs()[0] != `{"Fn::ImportValue" : {"Fn::Sub" : "${NetworkStackName}-EtcdSecurityGroup"}}` {
    44  		t.Errorf("etcd security group refs incorrect, expected: `{'Fn::ImportValue' : {'Fn::Sub' : '${NetworkStackName}-EtcdSecurityGroup'}}`, got: %s", etcdTest.SecurityGroupRefs()[0])
    45  	}
    46  
    47  	if err := etcdTest.Validate(); err != nil {
    48  		t.Error(err)
    49  	}
    50  
    51  	if etcdTest.FormatOpts() != "--quota-backend-bytes=100000000 --auto-compaction-retention=1" {
    52  		t.Errorf("etcd optional args incorrect, expected `--quota-backend-bytes=100000000 --auto-compaction-retention=1`, got: `%s`", etcdTest.FormatOpts())
    53  	}
    54  }