Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Commit d370dca

Browse files
committed
Updates to use new bbs and locket protobufs
1 parent 096ea81 commit d370dca

32 files changed

+382
-323
lines changed

commands/claim_lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func ClaimLock(
116116
Key: lockKey,
117117
Owner: lockOwner,
118118
Value: lockValue,
119-
TypeCode: models.LOCK,
119+
TypeCode: models.TypeCode_LOCK,
120120
},
121121
TtlInSeconds: ttlInSeconds,
122122
}

commands/claim_lock_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var _ = Describe("ClaimLock", func() {
4444
Key: "key",
4545
Owner: "owner",
4646
Value: "value",
47-
TypeCode: models.LOCK,
47+
TypeCode: models.TypeCode_LOCK,
4848
},
4949
TtlInSeconds: 60,
5050
}))

commands/claim_presence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func ClaimPresence(
108108
Key: lockKey,
109109
Owner: lockOwner,
110110
Value: lockValue,
111-
TypeCode: models.PRESENCE,
111+
TypeCode: models.TypeCode_PRESENCE,
112112
},
113113
TtlInSeconds: ttlInSeconds,
114114
}

commands/claim_presence_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var _ = Describe("ClaimPresence", func() {
4444
Key: "key",
4545
Owner: "owner",
4646
Value: "value",
47-
TypeCode: models.PRESENCE,
47+
TypeCode: models.TypeCode_PRESENCE,
4848
},
4949
TtlInSeconds: 60,
5050
}))

commands/locks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Locks(stdout, stderr io.Writer, locketClient models.LocketClient) error {
5959

6060
encoder := json.NewEncoder(stdout)
6161

62-
req := &models.FetchAllRequest{TypeCode: models.LOCK}
62+
req := &models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}
6363
resp, err := locketClient.FetchAll(context.Background(), req)
6464
if err != nil {
6565
return err

commands/locks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var _ = Describe("Locks", func() {
5050
Expect(fakeLocketClient.FetchAllCallCount()).To(Equal(1))
5151

5252
_, req, _ := fakeLocketClient.FetchAllArgsForCall(0)
53-
Expect(req).To(Equal(&models.FetchAllRequest{TypeCode: models.LOCK}))
53+
Expect(req).To(Equal(&models.FetchAllRequest{TypeCode: models.TypeCode_LOCK}))
5454

5555
d, err := json.Marshal(resources.Resources[0])
5656
Expect(err).NotTo(HaveOccurred())

commands/presences.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Presences(stdout, stderr io.Writer, locketClient models.LocketClient) error
5959

6060
encoder := json.NewEncoder(stdout)
6161

62-
req := &models.FetchAllRequest{TypeCode: models.PRESENCE}
62+
req := &models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}
6363
resp, err := locketClient.FetchAll(context.Background(), req)
6464
if err != nil {
6565
return err

commands/presences_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var _ = Describe("Presences", func() {
3636
Key: "key",
3737
Owner: "owner",
3838
Value: "value",
39-
TypeCode: models.PRESENCE,
39+
TypeCode: models.TypeCode_PRESENCE,
4040
},
4141
},
4242
}
@@ -50,7 +50,7 @@ var _ = Describe("Presences", func() {
5050
Expect(fakeLocketClient.FetchAllCallCount()).To(Equal(1))
5151

5252
_, req, _ := fakeLocketClient.FetchAllArgsForCall(0)
53-
Expect(req).To(Equal(&models.FetchAllRequest{TypeCode: models.PRESENCE}))
53+
Expect(req).To(Equal(&models.FetchAllRequest{TypeCode: models.TypeCode_PRESENCE}))
5454

5555
d, err := json.Marshal(resources.Resources[0])
5656
Expect(err).NotTo(HaveOccurred())

commands/update_desired_lrp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var _ = Describe("UpdateDesiredLRP", func() {
4141

4242
updatedInstanceCount := int32(4)
4343
dlu := models.DesiredLRPUpdate{}
44-
dlu.SetInstances(updatedInstanceCount)
44+
dlu.SetInstances(&updatedInstanceCount)
4545
updatedDesiredLRP = &dlu
4646

4747
spec, err = json.Marshal(updatedDesiredLRP)

integration/actual_lrp_groups_for_guid_test.go

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,29 @@ var _ = Describe("actual-lrp-groups-for-guid", func() {
2525
})
2626

2727
JustBeforeEach(func() {
28+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
29+
request := &models.ActualLRPGroupsByProcessGuidRequest{
30+
ProcessGuid: "random-guid",
31+
}
32+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
33+
response := &models.ActualLRPGroupsResponse{
34+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
35+
ActualLrpGroups: []*models.ActualLRPGroup{
36+
{
37+
Instance: &models.ActualLRP{
38+
State: "running",
39+
},
40+
},
41+
},
42+
}
2843
bbsServer.AppendHandlers(
2944
ghttp.CombineHandlers(
3045
ghttp.VerifyRequest("POST", "/v1/actual_lrp_groups/list_by_process_guid"),
3146
func(w http.ResponseWriter, req *http.Request) {
3247
time.Sleep(time.Duration(serverTimeout) * time.Second)
3348
},
34-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
35-
ghttp.VerifyProtoRepresenting(&models.ActualLRPGroupsByProcessGuidRequest{
36-
ProcessGuid: "random-guid",
37-
}),
38-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
39-
ghttp.RespondWithProto(200, &models.ActualLRPGroupsResponse{
40-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
41-
ActualLrpGroups: []*models.ActualLRPGroup{
42-
{
43-
Instance: &models.ActualLRP{
44-
State: "running",
45-
},
46-
},
47-
},
48-
}),
49+
ghttp.VerifyProtoRepresenting(request.ToProto()),
50+
ghttp.RespondWithProto(200, response.ToProto()),
4951
),
5052
)
5153
})
@@ -81,16 +83,17 @@ var _ = Describe("actual-lrp-groups-for-guid", func() {
8183

8284
Context("when the server returns an error", func() {
8385
BeforeEach(func() {
86+
response := &models.DomainsResponse{
87+
Error: &models.Error{
88+
Type: models.Error_Deadlock,
89+
Message: "the request failed due to deadlock",
90+
},
91+
Domains: nil,
92+
}
8493
bbsServer.AppendHandlers(
8594
ghttp.CombineHandlers(
8695
ghttp.VerifyRequest("POST", "/v1/actual_lrp_groups/list_by_process_guid"),
87-
ghttp.RespondWithProto(500, &models.DomainsResponse{
88-
Error: &models.Error{
89-
Type: models.Error_Deadlock,
90-
Message: "the request failed due to deadlock",
91-
},
92-
Domains: nil,
93-
}),
96+
ghttp.RespondWithProto(500, response.ToProto()),
9497
),
9598
)
9699
})
@@ -112,28 +115,30 @@ var _ = Describe("actual-lrp-groups-for-guid", func() {
112115

113116
Context("when passing index as filter", func() {
114117
BeforeEach(func() {
118+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
119+
request := &models.ActualLRPGroupByProcessGuidAndIndexRequest{
120+
ProcessGuid: "test-process-guid",
121+
Index: 1,
122+
}
123+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
124+
response := &models.ActualLRPGroupsResponse{
125+
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
126+
ActualLrpGroups: []*models.ActualLRPGroup{
127+
{
128+
Instance: &models.ActualLRP{
129+
ActualLrpKey: models.ActualLRPKey{
130+
Index: 1,
131+
},
132+
State: "running",
133+
},
134+
},
135+
},
136+
}
115137
bbsServer.AppendHandlers(
116138
ghttp.CombineHandlers(
117139
ghttp.VerifyRequest("POST", "/v1/actual_lrp_groups/get_by_process_guid_and_index"),
118-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
119-
ghttp.VerifyProtoRepresenting(&models.ActualLRPGroupByProcessGuidAndIndexRequest{
120-
ProcessGuid: "test-process-guid",
121-
Index: 1,
122-
}),
123-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
124-
ghttp.RespondWithProto(200, &models.ActualLRPGroupsResponse{
125-
//lint:ignore SA1019 - deprecated model used for testing deprecated functionality
126-
ActualLrpGroups: []*models.ActualLRPGroup{
127-
{
128-
Instance: &models.ActualLRP{
129-
ActualLRPKey: models.ActualLRPKey{
130-
Index: 1,
131-
},
132-
State: "running",
133-
},
134-
},
135-
},
136-
}),
140+
ghttp.VerifyProtoRepresenting(request.ToProto()),
141+
ghttp.RespondWithProto(200, response.ToProto()),
137142
),
138143
)
139144
})

0 commit comments

Comments
 (0)