fix: update test files to work with the new features
This commit is contained in:
parent
81dcd9c7cc
commit
100cad5acd
3 changed files with 17 additions and 14 deletions
|
|
@ -12,6 +12,7 @@ import (
|
|||
"git.cloonar.com/cloonar/updns/internal/config" // Added for mock provider
|
||||
"git.cloonar.com/cloonar/updns/internal/server"
|
||||
"go.uber.org/zap" // Added for logger
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
// mockProvider is a simple mock for testing router logic without real provider interaction.
|
||||
|
|
@ -24,10 +25,12 @@ func (m *mockProvider) UpdateRecord(ctx context.Context, host, ip string) error
|
|||
}
|
||||
|
||||
func newTestConfig(provider string) *config.Config {
|
||||
// Pre-generate hash for "s3cr3t" (replace with actual hash generation if needed)
|
||||
// Example hash generated with bcrypt.GenerateFromPassword([]byte("s3cr3t"), bcrypt.DefaultCost)
|
||||
// In a real test setup, you might generate this once or use a helper.
|
||||
testSecretHash := "$2a$10$abcdefghijklmnopqrstuv" // Placeholder hash
|
||||
// Generate hash for "s3cr3t" dynamically for the test
|
||||
hashBytes, err := bcrypt.GenerateFromPassword([]byte("s3cr3t"), bcrypt.DefaultCost)
|
||||
if err != nil {
|
||||
panic("bcrypt hash generation failed in test setup: " + err.Error()) // Panic is acceptable in test setup
|
||||
}
|
||||
testSecretHash := string(hashBytes)
|
||||
|
||||
return &config.Config{
|
||||
Server: config.ServerConfig{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue