Skip to content
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
6 changes: 3 additions & 3 deletions observability-lib/grafana/businessvariable/panel_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder {

// Panel height. The height is the number of rows from the top edge of the panel.
func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
if !(h > 0) {
if h <= 0 {
builder.errors["h"] = cog.MakeBuildErrors("h", errors.New("h must be > 0"))
return builder
}
Expand All @@ -106,11 +106,11 @@ func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {

// Panel width. The width is the number of columns from the left edge of the panel.
func (builder *PanelBuilder) Span(w uint32) *PanelBuilder {
if !(w > 0) {
if w <= 0 {
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be > 0"))
return builder
}
if !(w <= 24) {
if w > 24 {
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be <= 24"))
return builder
}
Expand Down
6 changes: 3 additions & 3 deletions observability-lib/grafana/polystat/panel_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (builder *PanelBuilder) GridPos(gridPos dashboard.GridPos) *PanelBuilder {

// Panel height. The height is the number of rows from the top edge of the panel.
func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {
if !(h > 0) {
if h <= 0 {
builder.errors["h"] = cog.MakeBuildErrors("h", errors.New("h must be > 0"))
return builder
}
Expand All @@ -107,11 +107,11 @@ func (builder *PanelBuilder) Height(h uint32) *PanelBuilder {

// Panel width. The width is the number of columns from the left edge of the panel.
func (builder *PanelBuilder) Span(w uint32) *PanelBuilder {
if !(w > 0) {
if w <= 0 {
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be > 0"))
return builder
}
if !(w <= 24) {
if w > 24 {
builder.errors["w"] = cog.MakeBuildErrors("w", errors.New("w must be <= 24"))
return builder
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/beholder/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,6 @@ func TestNewClient_Chip(t *testing.T) {
assert.NotNil(t, client)
assert.NotNil(t, client.Chip)

// Verify it implements the Client interface
var _ chipingress.Client = client.Chip

// Verify the emitter is configured as dual source
assert.NotNil(t, client.Emitter)
assert.IsType(t, &beholder.DualSourceEmitter{}, client.Emitter)
Expand All @@ -514,9 +511,6 @@ func TestNewClient_Chip(t *testing.T) {
assert.NotNil(t, client)
assert.NotNil(t, client.Chip)

// Verify it implements the Client interface
var _ chipingress.Client = client.Chip

// Verify emitter is not dual source when dual emitter is disabled
assert.NotNil(t, client.Emitter)
})
Expand Down
9 changes: 4 additions & 5 deletions pkg/beholder/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ func TestGlobal(t *testing.T) {
expectedMessageEmitter := beholder.NewNoopClient().Emitter
assert.IsType(t, expectedMessageEmitter, messageEmitter)

var noopClientPtr *beholder.Client = noopClient
assert.IsType(t, noopClientPtr, beholder.GetClient())
assert.NotSame(t, noopClientPtr, beholder.GetClient())
assert.IsType(t, noopClient, beholder.GetClient())
assert.NotSame(t, noopClient, beholder.GetClient())

// Set beholder client so it will be accessible from anywhere through beholder functions
beholder.SetClient(noopClientPtr)
assert.Same(t, noopClientPtr, beholder.GetClient())
beholder.SetClient(noopClient)
assert.Same(t, noopClient, beholder.GetClient())

// After that use beholder functions to get logger, tracer, meter, messageEmitter
logger, tracer, meter, messageEmitter = beholder.GetLogger(), beholder.GetTracer(), beholder.GetMeter(), beholder.GetEmitter()
Expand Down
1 change: 0 additions & 1 deletion pkg/beholder/noop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func TestNoopClient(t *testing.T) {

// Chip - verify noop chip client is initialized and functional
assert.NotNil(t, noopClient.Chip)
var _ chipingress.Client = noopClient.Chip
assert.IsType(t, &chipingress.NoopClient{}, noopClient.Chip)

// Test Chip methods return no errors
Expand Down
1 change: 0 additions & 1 deletion pkg/billing/workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type workflowClient struct {
}

type workflowConfig struct {
log logger.Logger
transportCredentials credentials.TransportCredentials
tlsCert string
serverName string
Expand Down
2 changes: 1 addition & 1 deletion pkg/capabilities/cli/cmd/generate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func ConfigFromSchemas(schemaFilePaths []string) (ConfigInfo, error) {
SchemaOutputFile: outputName,
}

configInfo.Config.SchemaMappings = append(configInfo.Config.SchemaMappings, generator.SchemaMapping{
configInfo.SchemaMappings = append(configInfo.SchemaMappings, generator.SchemaMapping{
SchemaID: jsonSchema.ID,
PackageName: path.Dir(jsonSchema.ID[8:]),
RootType: rootType,
Expand Down
4 changes: 0 additions & 4 deletions pkg/capabilities/cli/cmd/go_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ func (g *GoStructReader) gatherImports(node *ast.File, structs map[string]Struct
}
}

var allValues []string
var imports []string
var check []bool
for _, imp := range node.Imports {
var importName string
if imp.Name != nil {
Expand All @@ -149,8 +147,6 @@ func (g *GoStructReader) gatherImports(node *ast.File, structs map[string]Struct
}
importName = strings.Trim(importName, "\"")

allValues = append(allValues, importName)
check = append(check, requiredImports[importName])
if requiredImports[importName] {
imports = append(imports, imp.Path.Value)
}
Expand Down
10 changes: 6 additions & 4 deletions pkg/capabilities/consensus/ocr3/batching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ func TestQueryBatchHasCapacity(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// Handle special edge case tests that need dynamic size calculation
sizeLimit := tt.sizeLimit
if tt.name == "exactly at limit boundary" {
switch tt.name {
case "exactly at limit boundary":
// Calculate exact size needed for the new ID
newIdSize := calculateIdSize(tt.newId)
if newIdSize > 0 {
Expand All @@ -190,7 +191,7 @@ func TestQueryBatchHasCapacity(t *testing.T) {
} else {
sizeLimit = 0
}
} else if tt.name == "one byte over limit" {
case "one byte over limit":
// Calculate exact size needed for the new ID minus 1
newIdSize := calculateIdSize(tt.newId)
if newIdSize > 0 {
Expand Down Expand Up @@ -1334,14 +1335,15 @@ func TestReportBatchHasCapacity(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
// Handle special edge case tests that need dynamic size calculation
sizeLimit := tt.sizeLimit
if tt.name == "exactly at limit boundary" {
switch tt.name {
case "exactly at limit boundary":
// Calculate exact size needed for the new report
newReportSize := calculateReportSize(tt.newReport)
// Always include tag and length overhead, even for empty messages
tagSize := varintSize(uint64(2<<3 | 2))
lengthSize := varintSize(uint64(newReportSize))
sizeLimit = tagSize + lengthSize + newReportSize
} else if tt.name == "one byte over limit" {
case "one byte over limit":
// Calculate exact size needed for the new report minus 1
newReportSize := calculateReportSize(tt.newReport)
// Always include tag and length overhead, even for empty messages
Expand Down
5 changes: 3 additions & 2 deletions pkg/chainreader/contract_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,10 @@ func TestContractReaderByIDsQueryKey(t *testing.T) {

// Mock QueryKey function
mockReader.queryKeyFunc = func(ctx context.Context, contract types.BoundContract, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error) {
if contract == bc1 {
switch contract {
case bc1:
return []types.Sequence{{Data: "sequenceData1"}}, nil
} else if contract == bc2 {
case bc2:
return []types.Sequence{{Data: "sequenceData2"}}, nil
}
return nil, fmt.Errorf("not found")
Expand Down
8 changes: 2 additions & 6 deletions pkg/chains/aptos/proto_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func ConvertViewPayloadFromProto(proto *ViewPayload) (*typeaptos.ViewPayload, er
}

args := make([][]byte, len(proto.Args))
for i, protoArg := range proto.Args {
args[i] = protoArg
}
copy(args, proto.Args)

return &typeaptos.ViewPayload{
Module: module,
Expand Down Expand Up @@ -67,9 +65,7 @@ func ConvertViewPayloadToProto(payload *typeaptos.ViewPayload) (*ViewPayload, er
}

protoArgs := make([][]byte, len(payload.Args))
for i, arg := range payload.Args {
protoArgs[i] = arg
}
copy(protoArgs, payload.Args)

return &ViewPayload{
Module: protoModule,
Expand Down
2 changes: 1 addition & 1 deletion pkg/chains/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewPageToken(b64enc string) (*pageToken, error) {
if err != nil {
return nil, err
}
if !(vals.Has("page") && vals.Has("size")) {
if !vals.Has("page") || !vals.Has("size") {
return nil, ErrInvalidToken
}
page, err := strconv.Atoi(vals.Get("page"))
Expand Down
Loading
Loading