Fix bug in the test creation workflow
This commit is contained in:
parent
a6da3799a7
commit
dabbdc15d2
|
@ -170,6 +170,8 @@ func CreateNetwork(sess sqlbuilder.Database, location *utils.LocationInfo) (*Net
|
||||||
ASN: location.ASN,
|
ASN: location.ASN,
|
||||||
CountryCode: location.CountryCode,
|
CountryCode: location.CountryCode,
|
||||||
NetworkName: location.NetworkName,
|
NetworkName: location.NetworkName,
|
||||||
|
// On desktop we consider it to always be wifi
|
||||||
|
NetworkType: "wifi",
|
||||||
IP: location.IP,
|
IP: location.IP,
|
||||||
}
|
}
|
||||||
newID, err := sess.Collection("networks").Insert(network)
|
newID, err := sess.Collection("networks").Insert(network)
|
||||||
|
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/ooni/probe-cli/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMeasurementWorkflow(t *testing.T) {
|
func TestMeasurementWorkflow(t *testing.T) {
|
||||||
|
@ -24,7 +26,18 @@ func TestMeasurementWorkflow(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
result, err := CreateResult(sess, tmpdir, "websites", 0)
|
|
||||||
|
location := utils.LocationInfo{
|
||||||
|
ASN: 0,
|
||||||
|
CountryCode: "IT",
|
||||||
|
NetworkName: "Unknown",
|
||||||
|
}
|
||||||
|
network, err := CreateNetwork(sess, &location)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := CreateResult(sess, tmpdir, "websites", network.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import (
|
||||||
type Network struct {
|
type Network struct {
|
||||||
ID int64 `db:"id"`
|
ID int64 `db:"id"`
|
||||||
NetworkName string `db:"network_name"`
|
NetworkName string `db:"network_name"`
|
||||||
|
NetworkType string `db:"network_type"`
|
||||||
IP string `db:"ip"`
|
IP string `db:"ip"`
|
||||||
ASN uint `db:"asn"`
|
ASN uint `db:"asn"`
|
||||||
CountryCode string `db:"country_code"`
|
CountryCode string `db:"country_code"`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user