lotus/itests/kit/itestd.go

37 lines
573 B
Go
Raw Permalink Normal View History

2022-03-10 18:31:36 +00:00
package kit
import (
"bytes"
"encoding/json"
"net/http"
"os"
)
type ItestdNotif struct {
NodeType string // api env var name
TestName string
Api string
}
func sendItestdNotif(nodeType, testName, apiAddr string) {
td := os.Getenv("LOTUS_ITESTD")
if td == "" {
// not running
return
}
notif := ItestdNotif{
NodeType: nodeType,
TestName: testName,
Api: apiAddr,
}
nb, err := json.Marshal(&notif)
if err != nil {
return
}
if _, err := http.Post(td, "application/json", bytes.NewReader(nb)); err != nil { // nolint:gosec
return
}
}