Skip to content

Commit

Permalink
Remove unused tag and session api
Browse files Browse the repository at this point in the history
Signed-off-by: AndreyM <[email protected]>
  • Loading branch information
AndreyM committed May 30, 2023
1 parent 978eca8 commit 8d78a8f
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 221 deletions.
2 changes: 1 addition & 1 deletion ci/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ func upApp() error {
if err != nil {
return err
}
return sh.RunV("docker-compose", "-f", e2e.DockerFile, "up", "-d", "discopricer")
return sh.RunV("docker-compose", "-f", e2e.DockerFile, "up", "--build", "-d", "discopricer")
}
27 changes: 1 addition & 26 deletions e2e/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@ func Test_ProposalFiltering(t *testing.T) {
assert.Equal(t, "0x11", proposal.ProviderID)
assert.True(t, proposal.Quality.MonitoringFailed)

// 0x12 has not yet been monitored
proposal, ok = findProposal(proposals, func(p v3.Proposal) bool {
return p.ProviderID == "0x12"
})
assert.True(t, ok, "0x12 should not be in the list")
assert.Equal(t, "0x12", proposal.ProviderID)
assert.Nil(t, proposal.Quality.MonitoringFailed)

// 0x1 monitoring success
proposal, ok = findProposal(proposals, func(p v3.Proposal) bool {
return p.ProviderID == "0x1"
})
assert.True(t, ok, "0x1 should not be in the list")
assert.True(t, ok, "0x1 should be in the list")
assert.Equal(t, "0x1", proposal.ProviderID)
assert.False(t, proposal.Quality.MonitoringFailed)
})
Expand Down Expand Up @@ -151,21 +143,6 @@ func Test_ProposalFiltering(t *testing.T) {
}
})

// TODO make more robust tag e2e
t.Run("tags", func(t *testing.T) {
proposals, err := api.ListFilters(Query{Tags: "test,maybe"})
assert.NoError(t, err)
assert.Len(t, proposals, 5)

proposals, err = api.ListFilters(Query{Tags: "test"})
assert.NoError(t, err)
assert.Len(t, proposals, 5)

proposals, err = api.ListFilters(Query{Tags: "nosuchtag"})
assert.NoError(t, err)
assert.Len(t, proposals, 0)
})

t.Run("unregister", func(t *testing.T) {
for _, id := range []string{"0x1", "0x2", "0x3"} {
proposals, err := api.ListFilters(Query{ProviderID: []string{id}})
Expand Down Expand Up @@ -212,8 +189,6 @@ func publishProposals(t *testing.T) ([]*template, error) {
newTemplate().providerID("0x3").country("US").compatibility(2),
newTemplate().providerID("0x4").country("CN").compatibility(2).serviceType("wireguard"),
newTemplate().providerID("0x11").country("CN").compatibility(2),
// no session response
newTemplate().providerID("0x12").country("LT"),
}
for _, t := range templates {
if err := t.publishPing(); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions e2e/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"

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

type template struct {
Expand Down Expand Up @@ -37,6 +38,7 @@ 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
192 changes: 192 additions & 0 deletions e2e/wiremock/mappings/detailed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"request": {
"method": "GET",
"urlPattern": "/api/v2/providers/detailed.*"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json; charset=utf-8"
},
"jsonBody": {
"0x1.openvpn": {
"quality": 3.0,
"restrictedNode": true,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x1.wireguard": {
"quality": 3.0,
"restrictedNode": true,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x2.openvpn": {
"quality": 2.7,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x2.wireguard": {
"quality": 2.7,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x3.openvpn": {
"quality": 2.4,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x3.wireguard": {
"quality": 2.4,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x4.openvpn": {
"quality": 2.1,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x4.wireguard": {
"quality": 2.1,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x5.openvpn": {
"quality": 1.8,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x5.wireguard": {
"quality": 1.8,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x6.openvpn": {
"quality": 1.5,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x6.wireguard": {
"quality": 1.5,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x7.openvpn": {
"quality": 1.2,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x7.wireguard": {
"quality": 1.2,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x8.openvpn": {
"quality": 0.9,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x8.wireguard": {
"quality": 0.9,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x9.openvpn": {
"quality": 0.6,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x9.wireguard": {
"quality": 0.6,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x10.openvpn": {
"quality": 0.3,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x10.wireguard": {
"quality": 0.3,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24
},
"0x11.openvpn": {
"quality": 0.0,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24,
"monitoringFailed": true
},
"0x11.wireguard": {
"quality": 0.0,
"restrictedNode": false,
"connectionRate": 1,
"latency": 2581.775025,
"bandwidth": 50.094572,
"uptime": 24,
"monitoringFailed": true
}
}
}
}
Loading

0 comments on commit 8d78a8f

Please sign in to comment.