Skip to content

Commit

Permalink
Fix e2e unmonitoring test
Browse files Browse the repository at this point in the history
Signed-off-by: AndreyM <[email protected]>
  • Loading branch information
AndreyM committed May 31, 2023
1 parent 8d78a8f commit 7a2c48e
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func main() {

proposalsAPI := proposal.NewAPI(
proposalService,
proposalRepo,
locationProvider,
cfg.ProposalsCacheTTL,
cfg.ProposalsCacheLimit,
Expand Down
3 changes: 2 additions & 1 deletion e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ services:
environment:
- PORT=8080
- QUALITY_ORACLE_URL=http://wiremock:8080
- QUALITY_CACHE_TTL=20s
- QUALITY_CACHE_TTL=1s
- PROPOSALS_CACHE_TTL=0s
- BADGER_ADDRESS=http://wiremock:8080
- BROKER_URL=nats://broker
- LOCATION_ADDRESS=http://wiremock:8080
Expand Down
4 changes: 2 additions & 2 deletions e2e/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ func Test_ProposalFiltering(t *testing.T) {
err := newTemplate().providerID(providerID).publishPing()
assert.NoError(t, err)
assert.Eventuallyf(t, func() bool {
proposals, err := api.ListFilters(Query{ProviderID: []string{"notMockedInWiremock"}})
return len(proposals) == 1 && proposals[0].ProviderID == providerID && err == nil
proposals, err := api.ListFilters(Query{ProviderID: []string{"notMockedInWiremock"}, ServiceType: "openvpn"})
return len(proposals) == 0 && err == nil
}, time.Second*5, time.Millisecond*200, "proposal %s was not returned", providerID)
})
}
Expand Down
2 changes: 0 additions & 2 deletions e2e/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"

v3 "github.com/mysteriumnetwork/discovery/proposal/v3"
"github.com/prometheus/common/log"
)

type template struct {
Expand Down Expand Up @@ -38,7 +37,6 @@ func (t *template) compatibility(c int) *template {
}

func (t *template) publishPing() error {
log.Infof("Publishing ping: %v", t.proposalMessage)
err := defaultBroker.PublishPingOneV2(*t.proposalMessage)
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion listener/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func (l *Listener) Listen() error {
}

if _, err := conn.Subscribe("*.proposal-ping.v3", func(msg *nats.Msg) {
// log.Info().Msgf("Received a message [%s] %s", msg.Subject, string(msg.Data))
pingMsg := v3.ProposalPingMessage{}
if err := json.Unmarshal(msg.Data, &pingMsg); err != nil {
log.Err(err).Msg("Failed to parse proposal")
Expand Down
1 change: 0 additions & 1 deletion proposal/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type locationProvider interface {
}

func NewAPI(service *Service,
repository *Repository,
location locationProvider,
proposalsCacheTTL time.Duration,
proposalsCacheLimit int,
Expand Down
2 changes: 1 addition & 1 deletion proposal/v3/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (p ProposalUnregisterMessage) IsEmpty() bool {
}

func (p ProposalUnregisterMessage) Key() string {
return p.Proposal.ServiceType + ":" + p.Proposal.ProviderID
return p.Proposal.ProviderID + "." + p.Proposal.ServiceType
}

const Format = "service-proposal/v2"
Expand Down

0 comments on commit 7a2c48e

Please sign in to comment.