mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 17:17:22 +01:00
fix(metadata): reduce cache validity (#2161)
fix metadata cache validity too long
This commit is contained in:
parent
490ebe4f7f
commit
d568a73ab8
@ -6,7 +6,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/leonelquinteros/gotext"
|
"github.com/leonelquinteros/gotext"
|
||||||
|
|
||||||
@ -69,7 +68,6 @@ func BuildRuntime(cfg *Configuration, cmdArgs *parser.Arguments, version string)
|
|||||||
metadata.WithCacheFilePath(filepath.Join(cfg.BuildDir, "aur.json")),
|
metadata.WithCacheFilePath(filepath.Join(cfg.BuildDir, "aur.json")),
|
||||||
metadata.WithRequestEditorFn(userAgentFn),
|
metadata.WithRequestEditorFn(userAgentFn),
|
||||||
metadata.WithBaseURL(cfg.AURURL),
|
metadata.WithBaseURL(cfg.AURURL),
|
||||||
metadata.WithCustomCacheValidity(100000*time.Hour),
|
|
||||||
metadata.WithDebugLogger(logger.Debugln),
|
metadata.WithDebugLogger(logger.Debugln),
|
||||||
)
|
)
|
||||||
if errAURCache != nil {
|
if errAURCache != nil {
|
||||||
|
44
pkg/settings/runtime_test.go
Normal file
44
pkg/settings/runtime_test.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package settings_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/Jguer/yay/v12/pkg/settings"
|
||||||
|
"github.com/Jguer/yay/v12/pkg/settings/parser"
|
||||||
|
"github.com/Jguer/yay/v12/pkg/text"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestBuildRuntime(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
// Prepare test inputs
|
||||||
|
cfg := &settings.Configuration{
|
||||||
|
Debug: true,
|
||||||
|
UseRPC: false,
|
||||||
|
AURURL: "https://aur.archlinux.org",
|
||||||
|
AURRPCURL: "https://aur.archlinux.org/rpc",
|
||||||
|
BuildDir: "/tmp",
|
||||||
|
VCSFilePath: "",
|
||||||
|
Runtime: &settings.Runtime{Logger: text.NewLogger(nil, nil, nil, false, "")},
|
||||||
|
}
|
||||||
|
cmdArgs := parser.MakeArguments()
|
||||||
|
version := "1.0.0"
|
||||||
|
|
||||||
|
// Call the function being tested
|
||||||
|
runtime, err := settings.BuildRuntime(cfg, cmdArgs, version)
|
||||||
|
|
||||||
|
// Assert the function's output
|
||||||
|
assert.NotNil(t, runtime)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Nil(t, runtime.QueryBuilder)
|
||||||
|
assert.Nil(t, runtime.PacmanConf)
|
||||||
|
assert.NotNil(t, runtime.VCSStore)
|
||||||
|
assert.NotNil(t, runtime.CmdBuilder)
|
||||||
|
assert.NotNil(t, runtime.HTTPClient)
|
||||||
|
assert.NotNil(t, runtime.AURClient)
|
||||||
|
assert.NotNil(t, runtime.VoteClient)
|
||||||
|
assert.NotNil(t, runtime.AURCache)
|
||||||
|
assert.Nil(t, runtime.DBExecutor)
|
||||||
|
assert.NotNil(t, runtime.Logger)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user