mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Add ability for fixprobe to send the report from test/fixture
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/weaveworks/scope/common/xfer"
|
||||
"github.com/weaveworks/scope/probe/appclient"
|
||||
"github.com/weaveworks/scope/report"
|
||||
"github.com/weaveworks/scope/test/fixture"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -21,22 +22,27 @@ func main() {
|
||||
publishInterval = flag.Duration("publish.interval", 1*time.Second, "publish (output) interval")
|
||||
publishToken = flag.String("publish.token", "fixprobe", "publish token, for if we are talking to the service")
|
||||
publishID = flag.String("publish.id", "fixprobe", "publisher ID used to identify publishers")
|
||||
useFixture = flag.Bool("fixture", false, "Use the embedded fixture report.")
|
||||
)
|
||||
flag.Parse()
|
||||
|
||||
if len(flag.Args()) != 1 {
|
||||
if len(flag.Args()) != 1 && !*useFixture {
|
||||
log.Fatal("usage: fixprobe [--args] report.json")
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadFile(flag.Arg(0))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var fixedReport report.Report
|
||||
decoder := codec.NewDecoderBytes(b, &codec.JsonHandle{})
|
||||
if err := decoder.Decode(&fixedReport); err != nil {
|
||||
log.Fatal(err)
|
||||
if *useFixture {
|
||||
fixedReport = fixture.Report
|
||||
} else {
|
||||
b, err := ioutil.ReadFile(flag.Arg(0))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
decoder := codec.NewDecoderBytes(b, &codec.JsonHandle{})
|
||||
if err := decoder.Decode(&fixedReport); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
client, err := appclient.NewAppClient(appclient.ProbeConfig{
|
||||
|
||||
Reference in New Issue
Block a user