Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix proxy tests #1255

Merged
merged 3 commits into from
Nov 13, 2024
Merged
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
8 changes: 8 additions & 0 deletions grid-proxy/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions grid-proxy/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,14 @@
"TwinConsumption"
],
"summary": "Show a report for user consumption",
"parameters": [
{
"type": "integer",
"description": "twin id",
"name": "twin_id",
"in": "path"
}
],
"responses": {
"200": {
"description": "OK",
Expand Down
5 changes: 5 additions & 0 deletions grid-proxy/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,11 @@ paths:
consumes:
- application/json
description: Get a report of user spent for last hour and for lifetime
parameters:
- description: twin id
in: path
name: twin_id
type: integer
produces:
- application/json
responses:
Expand Down
1 change: 1 addition & 0 deletions grid-proxy/internal/explorer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ func (a *App) listTwins(r *http.Request) (interface{}, mw.Response) {
// @Summary Show a report for user consumption
// @Description Get a report of user spent for last hour and for lifetime
// @Tags TwinConsumption
// @Param twin_id path int yes "twin id"
// @Accept json
// @Produce json
// @Success 200 {object} []types.TwinConsumption
Expand Down
4 changes: 2 additions & 2 deletions grid-proxy/tests/queries/mock_client/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ func (g *GridProxyMockClient) Contract(ctx context.Context, contractID uint32) (
Type: "rent",
Details: types.RentContractDetails{
NodeID: uint(rentContract.NodeID),
FarmId: g.data.Nodes[nodeContract.NodeID].FarmID,
FarmName: g.data.Farms[g.data.Nodes[nodeContract.NodeID].FarmID].Name,
FarmId: g.data.Nodes[rentContract.NodeID].FarmID,
FarmName: g.data.Farms[g.data.Nodes[rentContract.NodeID].FarmID].Name,
},
}, err
}
Expand Down
3 changes: 1 addition & 2 deletions grid-proxy/tests/queries/mock_client/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ func (g *GridProxyMockClient) Nodes(ctx context.Context, filter types.NodeFilter
return res[i].NodeID < res[j].NodeID
})

if filter.AvailableFor != nil {
if filter.AvailableFor != nil || filter.RentableOrRentedBy != nil {
sort.Slice(res, func(i, j int) bool {

return g.data.NodeRentContractID[uint64(res[i].NodeID)] != 0
})
}
Expand Down
Loading