github.com/Rookout/GoSDK@v0.1.48/cmd/connectivity_test/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"runtime"
     7  
     8  	rookout "github.com/Rookout/GoSDK"
     9  	"github.com/Rookout/GoSDK/pkg"
    10  	"github.com/Rookout/GoSDK/pkg/information"
    11  )
    12  
    13  func main() {
    14  	fmt.Println("[Rookout] Testing connection to controller.")
    15  	fmt.Printf("[Rookout] Rookout version: %s (%s)\n", information.VERSION, runtime.Version())
    16  
    17  	err := startSingleton()
    18  	if err != nil {
    19  		fmt.Printf("[Rookout] Error occured during test: %v\n", err)
    20  		fmt.Println("[Rookout] Test failed.")
    21  		os.Exit(1)
    22  	}
    23  
    24  	fmt.Println("[Rookout] Test finished successfully.")
    25  }
    26  
    27  func startSingleton() error {
    28  	s := pkg.GetSingleton()
    29  	err := s.Start(&rookout.RookOptions{})
    30  	if err != nil {
    31  		return err
    32  	}
    33  
    34  	s.Stop()
    35  	return nil
    36  }