Skip to content

Commit

Permalink
Fix consumer rendering in info command (#87)
Browse files Browse the repository at this point in the history
* fix consumer in info command
* update dependencies
  • Loading branch information
jandelgado authored Jun 9, 2024
1 parent 94435a7 commit 3d9dfce
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.21.3
go-version: 1.22.4
- name: Checkout code
uses: actions/checkout@v4
- name: Run GoReleaser
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
- master

env:
GO_VERSION: "1.21.3"
GO_LANG_CI_LINT_VERSION: "v1.53.3"
GO_VERSION: "1.22.4"
GO_LANG_CI_LINT_VERSION: "v1.59.1"

name: run tests
jobs:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for rabtap

## v1.39.1 (2024-06-089

* fix consumer incorrectly displayed in info command
* update dependencies & go

## v1.39.0 (2023-10-29)

* experimental WASM support, use go 1.21, simplify code
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine as builder
FROM golang:1.22-alpine as builder
ARG version

WORKDIR /go/src/app
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SOURCE=$(shell find . -name "*go" -a -not -path "./vendor/*" -not -path "./cmd/testgen/*" )
VERSION=$(shell git describe --tags)
TOXICMD:=docker-compose exec toxiproxy /go/bin/toxiproxy-cli
TOXICMD:=docker compose exec toxiproxy /go/bin/toxiproxy-cli

.PHONY: phony

Expand Down Expand Up @@ -46,7 +46,7 @@ toxiproxy-cmd: phony
# run rabbitmq server for integration test using docker container.
run-broker: phony
cd inttest/pki && ./mkcerts.sh
cd inttest/rabbitmq && docker-compose up
cd inttest/rabbitmq && docker compose up

dist-clean: clean
rm -rf *.out bin/ dist/
Expand Down
28 changes: 15 additions & 13 deletions cmd/rabtap/broker_info_tree_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (s defaultBrokerInfoTreeBuilder) createConnectionNodes(

vhostName := queue.Vhost
for _, consumer := range metadataService.Consumers() { // TODO AllConsumersByQueue
consumer := consumer
if !(consumer.Queue.Vhost == vhostName && consumer.Queue.Name == queue.Name) {
continue
}
Expand Down Expand Up @@ -336,14 +337,14 @@ func (s defaultBrokerInfoTreeBuilder) createRootNode(rootNodeURL *url.URL,
}

// buildTree renders given brokerInfo into a tree:
// RabbitMQ-Host
// +--VHost
// +--Exchange
// +--Queue bound to exchange
// +--Connection (optional)
// +--Channel
// +--Consumer
//
// RabbitMQ-Host
// +--VHost
// +--Exchange
// +--Queue bound to exchange
// +--Connection (optional)
// +--Channel
// +--Consumer
func (s defaultBrokerInfoTreeBuilder) buildTreeByExchange(
rootNodeURL *url.URL,
metadataService rabtap.MetadataService) (*rootNode, error) {
Expand Down Expand Up @@ -371,12 +372,13 @@ func (s defaultBrokerInfoTreeBuilder) buildTreeByExchange(
}

// buildTree renders given brokerInfo into a tree:
// RabbitMQ-Host
// +--VHost
// +--Connection
// +--Channel
// +--Consumer (opt)
// +--Queue
//
// RabbitMQ-Host
// +--VHost
// +--Connection
// +--Channel
// +--Consumer (opt)
// +--Queue
func (s defaultBrokerInfoTreeBuilder) buildTreeByConnection(
rootNodeURL *url.URL,
metadataService rabtap.MetadataService) (*rootNode, error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/rabtap/cmd_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestCmdInfoByExchangeInTextFormatProducesExpectedTree(t *testing.T) {
│ │ │ └─ another_consumer w/ faulty channel (consumer prefetch=0, ack_req=no, active=no, status=)
│ │ └─ '172.17.0.1:40874 -> 172.17.0.2:5672' (connection [email protected]:5672, state='running', client='https://github.com/streadway/amqp', ver='β', peer='172.17.0.1:40874')
│ │ └─ '172.17.0.1:40874 -> 172.17.0.2:5672 (1)' (channel prefetch=0, state=running, unacked=0, confirms=no)
│ │ └─ another_consumer w/ faulty channel (consumer prefetch=0, ack_req=no, active=no, status=)
│ │ └─ some_consumer (consumer prefetch=0, ack_req=no, active=no, status=)
│ └─ direct-q2 (queue(classic), key='direct-q2', running, [D])
├─ test-fanout (exchange(fanout), [D])
│ ├─ fanout-q1 (queue(classic), idle since 2017-05-25 19:14:32, [D])
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ go 1.18
require (
github.com/Knetic/govaluate v0.0.0-20171022003610-9aa49832a739 //v0.0.0-20171022003610-9aa49832a739
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/fatih/color v1.15.0
github.com/google/uuid v1.4.0
github.com/fatih/color v1.17.0
github.com/google/uuid v1.6.0
github.com/mattn/go-colorable v0.1.13
github.com/rabbitmq/amqp091-go v1.9.0
github.com/rabbitmq/amqp091-go v1.10.0
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af
github.com/stretchr/testify v1.8.4
golang.org/x/net v0.17.0
golang.org/x/sync v0.4.0
github.com/stretchr/testify v1.9.0
golang.org/x/net v0.26.0
golang.org/x/sync v0.7.0
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
)

Expand All @@ -22,6 +22,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.21.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
Expand All @@ -23,6 +27,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc3Aoo=
github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc=
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af h1:Sp5TG9f7K39yfB+If0vjp97vuT74F72r8hfRpP8jLU0=
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stealthrocket/net v0.2.1 h1:PehPGAAjuV46zaeHGlNgakFV7QDGUAREMcEQsZQ8NLo=
Expand All @@ -34,17 +40,26 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down

0 comments on commit 3d9dfce

Please sign in to comment.