mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-08-07 01:33:52 +00:00
feat(rubick): rename project and add production release bundle
This commit is contained in:
commit
fab6cf26eb
33 changed files with 11554 additions and 0 deletions
67
tests/go/live_e2e_test.go
Normal file
67
tests/go/live_e2e_test.go
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
package gotests
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func isTransientNetworkErr(out string) bool {
|
||||
s := strings.ToLower(out)
|
||||
patterns := []string{
|
||||
"no such host", "timeout", "tempor", "connection reset", "connection refused", "429",
|
||||
}
|
||||
for _, p := range patterns {
|
||||
if strings.Contains(s, p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func TestLiveMSNScreener(t *testing.T) {
|
||||
if os.Getenv("RUN_LIVE_E2E") != "1" {
|
||||
t.Skip("set RUN_LIVE_E2E=1 to run live tests")
|
||||
}
|
||||
|
||||
outFile := filepath.Join(repoRoot(), "output", "live_test_screener.json")
|
||||
code, out := runCLILive(t, nil,
|
||||
"msn", "screener",
|
||||
"--region", "id",
|
||||
"--filter", "large-cap",
|
||||
"--limit", "1",
|
||||
"--output", outFile,
|
||||
)
|
||||
if code != 0 {
|
||||
if isTransientNetworkErr(out) {
|
||||
t.Skipf("transient/live network issue: %s", out)
|
||||
}
|
||||
t.Fatalf("live screener failed: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLiveNewsQuery(t *testing.T) {
|
||||
if os.Getenv("RUN_LIVE_E2E") != "1" {
|
||||
t.Skip("set RUN_LIVE_E2E=1 to run live tests")
|
||||
}
|
||||
if os.Getenv("BRAVE_API_KEY") == "" {
|
||||
t.Skip("BRAVE_API_KEY not set")
|
||||
}
|
||||
|
||||
outFile := filepath.Join(repoRoot(), "output", "live_test_news.json")
|
||||
code, out := runCLILive(t, nil,
|
||||
"news", "IHSG",
|
||||
"--from", "2026-03-04",
|
||||
"--to", "2026-03-06",
|
||||
"--count", "1",
|
||||
"--concurrency", "1",
|
||||
"--output", outFile,
|
||||
)
|
||||
if code != 0 {
|
||||
if isTransientNetworkErr(out) {
|
||||
t.Skipf("transient/live network issue: %s", out)
|
||||
}
|
||||
t.Fatalf("live news failed: %s", out)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue