This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
2019-02-12 11:12:50 +01:00
|
|
|
package emlid
|
2018-09-19 17:13:45 +02:00
|
|
|
|
|
|
|
import (
|
2018-09-26 12:05:55 +02:00
|
|
|
"context"
|
2018-09-19 17:13:45 +02:00
|
|
|
"testing"
|
2018-09-26 12:05:55 +02:00
|
|
|
"time"
|
2018-09-19 17:13:45 +02:00
|
|
|
)
|
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
func TestClientRebootNow(t *testing.T) {
|
2018-09-19 17:13:45 +02:00
|
|
|
|
2018-09-21 12:31:52 +02:00
|
|
|
if !*runRebootTest {
|
2019-02-12 11:12:50 +01:00
|
|
|
t.Skip("To run this test, use: go test -reboot-test")
|
2018-09-21 12:31:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
client := NewClient(
|
2019-02-12 11:12:50 +01:00
|
|
|
WithStandardLogger(),
|
|
|
|
WithEndpoint(*reachHost, 80),
|
2018-09-19 17:13:45 +02:00
|
|
|
)
|
|
|
|
if err := client.Connect(); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2018-09-26 12:05:55 +02:00
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
|
|
defer cancel()
|
|
|
|
if err := client.RebootNow(ctx, true); err != nil {
|
2018-09-19 17:13:45 +02:00
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
defer client.Close()
|
|
|
|
|
|
|
|
}
|