Skip to content

Commit 62493f0

Browse files
committed
PR feedback
1 parent a57aa19 commit 62493f0

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

internal/config/config_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ package config
77
import (
88
_ "embed"
99
"errors"
10-
"fmt"
1110
"os"
1211
"path"
1312
"strings"
1413
"testing"
1514
"time"
1615

16+
conf "github.com/nginx/agent/v3/test/config"
17+
1718
"github.com/nginx/agent/v3/pkg/config"
1819

1920
"github.com/nginx/agent/v3/test/helpers"
@@ -637,13 +638,6 @@ func TestValidateYamlFile(t *testing.T) {
637638
}
638639
}
639640

640-
//go:embed testdata/nginx-agent-with-token.conf
641-
var agentConfigWithToken string
642-
643-
func getAgentConfigWithToken(token string) string {
644-
return fmt.Sprintf(agentConfigWithToken, token)
645-
}
646-
647641
func TestResolveExtensions(t *testing.T) {
648642
tests := []struct {
649643
name string
@@ -675,7 +669,7 @@ func TestResolveExtensions(t *testing.T) {
675669
tempFile := helpers.CreateFileWithErrorCheck(t, tempDir, "nginx-agent.conf")
676670
defer helpers.RemoveFileWithErrorCheck(t, tempFile.Name())
677671

678-
confContent := []byte(getAgentConfigWithToken(tt.input))
672+
confContent := []byte(conf.GetAgentConfigWithToken(tt.input))
679673
_, writeErr := tempFile.Write(confContent)
680674
require.NoError(t, writeErr)
681675

File renamed without changes.

test/config/nginx_config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ var embedNginxConfWithMultipleSSLCerts string
2525
//go:embed nginx/nginx-ssl-certs-with-variables.conf
2626
var embedNginxConfWithSSLCertsWithVariables string
2727

28+
//go:embed agent/nginx-agent-with-token.conf
29+
var agentConfigWithToken string
30+
2831
func GetNginxConfigWithMultipleAccessLogs(
2932
errorLogName,
3033
accessLogName,
@@ -55,3 +58,7 @@ func GetNginxConfigWithSSLCerts(errorLogFile, accessLogFile, certFile string) st
5558
func GetNginxConfigWithMultipleSSLCerts(errorLogFile, accessLogFile, certFile1, certFile2 string) string {
5659
return fmt.Sprintf(embedNginxConfWithMultipleSSLCerts, errorLogFile, accessLogFile, certFile1, certFile2)
5760
}
61+
62+
func GetAgentConfigWithToken(token string) string {
63+
return fmt.Sprintf(agentConfigWithToken, token)
64+
}

0 commit comments

Comments
 (0)