feat: each provider can have its own timeout
providers.azure.timeout, providers.databricks.timeout and providers.repos.timeout override providers.timeout for that provider's requests; --timeout still sets them all. lazysecrets share, which reads a key and repo files, waits the longest of them.
This commit is contained in:
11 files changed
+106
-29
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/provider"
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/provider/fake"
|
||||
)
|
||||
|
||||
// A provider's own timeout applies to it alone.
|
||||
func TestTimeoutPerProvider(t *testing.T) {
|
||||
t.Parallel()
|
||||
d := newDriverOpts(t, Options{Timeout: 5 * time.Second, Timeouts: map[provider.Kind]time.Duration{provider.KindAzure: 10 * time.Millisecond}},
|
||||
fake.Azure(300*time.Millisecond), fake.Databricks(300*time.Millisecond))
|
||||
scr := d.screen()
|
||||
if !strings.Contains(scr, "✗ Azure: context deadline exceeded") || !strings.Contains(scr, "Databricks (…)") ||
|
||||
strings.Contains(scr, "Databricks: context deadline") {
|
||||
t.Errorf("want Azure timed out and Databricks still loading:\n%s", scr)
|
||||
}
|
||||
if got := (timeouts{def: time.Minute}).of(provider.KindRepo); got != time.Minute {
|
||||
t.Errorf("no override: %s, want the default", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user