Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions internal/gcp/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ func GetLocalTime(timestamp string) (string, error) {

launchTime, err := time.Parse("2006-01-02T15:04:05.999-07:00", timestamp)
if err != nil {
return "", fmt.Errorf("Error parsing timestamp : ", err)
return "", fmt.Errorf("Error parsing timestamp: %v", err)
}
localZone, err := config.GetLocalTimeZone()
if err != nil {
return "", fmt.Errorf("Error loading local timezone: ", err)
return "", fmt.Errorf("Error loading local timezone: %v", err)
}
loc, _ := time.LoadLocation(localZone)
IST := launchTime.In(loc)
Expand Down
17 changes: 9 additions & 8 deletions internal/render/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestEc2Render(t *testing.T) {
resp := aws.EC2Resp{InstanceId: "ec2-instance-1", InstanceState: "running", InstanceType: "t2.micro", MonitoringState: "disabled", PublicDNS: "public-dns", LaunchTime: "9:00:00", AvailabilityZone: "us-east-1e"}
resp := aws.EC2Resp{Name: "server", InstanceId: "ec2-instance-1", InstanceState: "running", InstanceType: "t2.micro", MonitoringState: "disabled", PublicDNS: "public-dns", LaunchTime: "9:00:00", AvailabilityZone: "us-east-1e"}
var ec2 EC2

r := NewRow(7)
Expand All @@ -17,15 +17,16 @@ func TestEc2Render(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, "ec2", r.ID)

e := Fields{"ec2-instance-1", "running", "t2.micro", "disabled", "9:00:00", "public-dns", "us-east-1e"}
e := Fields{"ec2-instance-1", "server", "running", "t2.micro", "disabled", "9:00:00", "public-dns", "us-east-1e"}
assert.Equal(t, e, r.Fields[0:])

headers := ec2.Header()
assert.Equal(t, 0, headers.IndexOf("Instance-Id", false))
assert.Equal(t, 1, headers.IndexOf("Instance-State", false))
assert.Equal(t, 2, headers.IndexOf("Instance-Type", false))
assert.Equal(t, 3, headers.IndexOf("Monitoring-State", false))
assert.Equal(t, 4, headers.IndexOf("Launch-Time", false))
assert.Equal(t, 5, headers.IndexOf("Public-DNS", true))
assert.Equal(t, 6, headers.IndexOf("Availability-Zone", false))
assert.Equal(t, 1, headers.IndexOf("Name", false))
assert.Equal(t, 2, headers.IndexOf("Instance-State", false))
assert.Equal(t, 3, headers.IndexOf("Instance-Type", false))
assert.Equal(t, 4, headers.IndexOf("Monitoring-State", false))
assert.Equal(t, 5, headers.IndexOf("Launch-Time", false))
assert.Equal(t, 6, headers.IndexOf("Public-DNS", true))
assert.Equal(t, 7, headers.IndexOf("Availability-Zone", false))
}
2 changes: 1 addition & 1 deletion internal/view/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ func TestNewEc2(t *testing.T) {
ec2 := NewEC2("ec2")
assert.Nil(t, ec2.Init(makeCtx()))
assert.Equal(t, "ec2", ec2.Name())
assert.Equal(t, 11, len(ec2.Hints()))
assert.Equal(t, 12, len(ec2.Hints()))
}
2 changes: 1 addition & 1 deletion internal/view/ecs_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ func TestNewEcsCluster(t *testing.T) {
ecs := NewEcs("ecs:c")
assert.Nil(t, ecs.Init(makeCtx()))
assert.Equal(t, "ecs:c", ecs.Name())
assert.Equal(t, 5, len(ecs.Hints()))
assert.Equal(t, 7, len(ecs.Hints()))
}
2 changes: 1 addition & 1 deletion internal/view/vm_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ func TestNewVMI(t *testing.T) {
vmi := NewVMI("vmi")
assert.Nil(t, vmi.Init(makeCtx()))
assert.Equal(t, "vmi", vmi.Name())
assert.Equal(t, 6, len(vmi.Hints()))
assert.Equal(t, 7, len(vmi.Hints()))
}