Use ooni/probe-engine: episode 1 (#42)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-engine/model"
|
||||
"github.com/ooni/probe-cli/utils"
|
||||
"github.com/pkg/errors"
|
||||
db "upper.io/db.v3"
|
||||
@@ -193,14 +194,14 @@ func CreateResult(sess sqlbuilder.Database, homePath string, testGroupName strin
|
||||
}
|
||||
|
||||
// CreateNetwork will create a new network in the network table
|
||||
func CreateNetwork(sess sqlbuilder.Database, location *utils.LocationInfo) (*Network, error) {
|
||||
func CreateNetwork(sess sqlbuilder.Database, location *model.LocationInfo) (*Network, error) {
|
||||
network := Network{
|
||||
ASN: location.ASN,
|
||||
CountryCode: location.CountryCode,
|
||||
NetworkName: location.NetworkName,
|
||||
// On desktop we consider it to always be wifi
|
||||
NetworkType: "wifi",
|
||||
IP: location.IP,
|
||||
IP: location.ProbeIP,
|
||||
}
|
||||
newID, err := sess.Collection("networks").Insert(network)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ooni/probe-cli/utils"
|
||||
"github.com/ooni/probe-engine/model"
|
||||
db "upper.io/db.v3"
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestMeasurementWorkflow(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
location := utils.LocationInfo{
|
||||
location := model.LocationInfo{
|
||||
ASN: 0,
|
||||
CountryCode: "IT",
|
||||
NetworkName: "Unknown",
|
||||
@@ -103,7 +103,7 @@ func TestDeleteResult(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
location := utils.LocationInfo{
|
||||
location := model.LocationInfo{
|
||||
ASN: 0,
|
||||
CountryCode: "IT",
|
||||
NetworkName: "Unknown",
|
||||
@@ -175,13 +175,13 @@ func TestNetworkCreate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
l1 := utils.LocationInfo{
|
||||
l1 := model.LocationInfo{
|
||||
ASN: 2,
|
||||
CountryCode: "IT",
|
||||
NetworkName: "Antaninet",
|
||||
}
|
||||
|
||||
l2 := utils.LocationInfo{
|
||||
l2 := model.LocationInfo{
|
||||
ASN: 3,
|
||||
CountryCode: "IT",
|
||||
NetworkName: "Fufnet",
|
||||
|
||||
Reference in New Issue
Block a user