Skip to content

Commit

Permalink
Merge branch 'master' into bug/allocator-qps
Browse files Browse the repository at this point in the history
  • Loading branch information
roberthbailey authored Oct 24, 2020
2 parents e3140c3 + b8321fa commit 3c9e050
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/allocation/converters/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ func ConvertAllocationResponseToGSA(in *pb.AllocationResponse) *allocationv1.Gam
}

out := &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: allocationv1.SchemeGroupVersion.Group,
APIVersion: allocationv1.SchemeGroupVersion.Version,
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationAllocated,
GameServerName: in.GameServerName,
Expand Down
24 changes: 24 additions & 0 deletions pkg/allocation/converters/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ func TestConvertGSAToAllocationResponse(t *testing.T) {
{
name: "status state is set to allocated",
in: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationAllocated,
GameServerName: "GSN",
Expand Down Expand Up @@ -263,6 +267,10 @@ func TestConvertGSAToAllocationResponse(t *testing.T) {
{
name: "status field is set to unallocated",
in: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationUnAllocated,
GameServerName: "GSN",
Expand All @@ -284,6 +292,10 @@ func TestConvertGSAToAllocationResponse(t *testing.T) {
{
name: "status state is set to contention",
in: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationContention,
},
Expand All @@ -294,6 +306,10 @@ func TestConvertGSAToAllocationResponse(t *testing.T) {
{
name: "Empty fields",
in: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
Ports: []agonesv1.GameServerStatusPort{},
},
Expand All @@ -304,6 +320,10 @@ func TestConvertGSAToAllocationResponse(t *testing.T) {
{
name: "Empty objects",
in: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationAllocated,
},
Expand Down Expand Up @@ -355,6 +375,10 @@ func TestConvertAllocationResponseToGSA(t *testing.T) {
Ports: []*pb.AllocationResponse_GameServerStatusPort{},
},
want: &allocationv1.GameServerAllocation{
TypeMeta: metav1.TypeMeta{
Kind: "allocation.agones.dev",
APIVersion: "v1",
},
Status: allocationv1.GameServerAllocationStatus{
State: allocationv1.GameServerAllocationAllocated,
},
Expand Down

0 comments on commit 3c9e050

Please sign in to comment.