Skip to content

Commit

Permalink
Merge pull request #77 from m-lab/sandbox-format
Browse files Browse the repository at this point in the history
fix json escape quota problem
  • Loading branch information
yachang authored May 28, 2020
2 parents 608d1a7 + d49d100 commit 5f6fd36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

type HopIP struct {
IP string `json:"ip,string"`
Hostname string `json:"hostname,string"`
IP string `json:"ip"`
Hostname string `json:"hostname"`
Geo *annotator.Geolocation `json:"geo"`
Network *annotator.Network `json:"network"`
}
Expand All @@ -31,18 +31,18 @@ type ScamperHop struct {
}

type PTTestRaw struct {
SchemaVersion string `json:"schema_version,string" bigquery:"schema_version"`
UUID string `json:"uuid,string" bigquery:"uuid"`
SchemaVersion string `json:"schema_version" bigquery:"schema_version"`
UUID string `json:"uuid" bigquery:"uuid"`
TestTime time.Time `json:"testtime"`
StartTime int64 `json:"start_time,int64" bigquery:"start_time"`
StopTime int64 `json:"stop_time,int64" bigquery:"stop_time"`
ScamperVersion string `json:"scamper_version,string" bigquery:"scamper_version"`
ServerIP string `json:"serverIP,string" bigquery:"serverip"`
ClientIP string `json:"clientIP,string" bigquery:"clientip"`
ScamperVersion string `json:"scamper_version" bigquery:"scamper_version"`
ServerIP string `json:"serverIP" bigquery:"serverip"`
ClientIP string `json:"clientIP" bigquery:"clientip"`
ProbeSize int64 `json:"probe_size,int64"`
ProbeC int64 `json:"probec,int64"`
Hop []ScamperHop `json:"hop"`
CachedResult bool `json:"cached_result,bool" bigquery:"cached_result"`
CachedUUID string `json:"cached_uuid,string" bigquery:"cached_uuid"`
TracerouteCallerCommit string `json:"traceroutecaller_commit,string" bigquery:"traceroutecaller_caller"`
CachedUUID string `json:"cached_uuid" bigquery:"cached_uuid"`
TracerouteCallerCommit string `json:"traceroutecaller_commit" bigquery:"traceroutecaller_caller"`
}
2 changes: 1 addition & 1 deletion tracer/scamper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func TestAnnotateHops(t *testing.T) {
t.Error("Should succeed here")
}
// Notice that "asn" is 5 for IP "1.2.3.4"
expectedOutput := `{"schema_version":"\"\"","uuid":"\"\"","testtime":"0001-01-01T00:00:00Z","start_time":0,"stop_time":0,"scamper_version":"\"\"","serverIP":"\"\"","clientIP":"\"\"","probe_size":0,"probec":0,"hop":[{"source":{"ip":"\"1.2.3.4\"","hostname":"\"\"","geo":{"Missing":true},"network":{"CIDR":"1.2.3.4/32","ASNumber":5,"ASName":"Test Number Five","Systems":[{"ASNs":[5]}]}},"linkc":0,"link":null},{"source":{"ip":"\"1.47.236.62\"","hostname":"\"\"","geo":{"Missing":true},"network":{"Missing":true}},"linkc":0,"link":null}],"cached_result":false,"cached_uuid":"\"\"","traceroutecaller_commit":"\"\""}`
expectedOutput := `{"schema_version":"","uuid":"","testtime":"0001-01-01T00:00:00Z","start_time":0,"stop_time":0,"scamper_version":"","serverIP":"","clientIP":"","probe_size":0,"probec":0,"hop":[{"source":{"ip":"1.2.3.4","hostname":"","geo":{"Missing":true},"network":{"CIDR":"1.2.3.4/32","ASNumber":5,"ASName":"Test Number Five","Systems":[{"ASNs":[5]}]}},"linkc":0,"link":null},{"source":{"ip":"1.47.236.62","hostname":"","geo":{"Missing":true},"network":{"Missing":true}},"linkc":0,"link":null}],"cached_result":false,"cached_uuid":"","traceroutecaller_commit":""}`
if string(sd2.GetData()) != string(expectedOutput) {
t.Error("Fail to add annotation.")
}
Expand Down

0 comments on commit 5f6fd36

Please sign in to comment.