lotus/itests/kit/itestd.go
2022-03-10 19:39:10 +01:00

37 lines
573 B
Go

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
}
}