-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatasets_test.go
More file actions
46 lines (38 loc) · 977 Bytes
/
datasets_test.go
File metadata and controls
46 lines (38 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package gospice
import (
"context"
"testing"
"time"
)
func TestLocalRuntimeDatasetRefresh(t *testing.T) {
spice := NewSpiceClient()
defer func() { _ = spice.Close() }()
if err := spice.Init(WithHttpAddress("http://127.0.0.1:8090")); err != nil {
t.Fatalf("error initializing SpiceClient: %v", err)
}
ctx := context.Background()
// Check if Spice is healthy
if !spice.IsSpiceHealthy(ctx) {
t.Fatal("Spice instance is not healthy")
}
// Wait for Spice to be ready (with timeout)
timeout := time.After(120 * time.Second)
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
ready := false
for !ready {
select {
case <-timeout:
t.Fatal("Timed out waiting for Spice to be ready")
case <-ticker.C:
if spice.IsSpiceReady(ctx) {
ready = true
}
}
}
t.Run("Refresh Dataset", func(t *testing.T) {
if err := spice.RefreshDataset(ctx, "taxi_trips", nil); err != nil {
t.Fatalf("error refreshing dataset: %v", err)
}
})
}