37 lines
573 B
Go
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(¬if)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
if _, err := http.Post(td, "application/json", bytes.NewReader(nb)); err != nil { // nolint:gosec
|
||
|
return
|
||
|
}
|
||
|
}
|