Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default local blueprint #230

Merged
merged 8 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/blueprint/blueprint_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (b *BaseBlueprintHandler) LoadConfig(path ...string) error {
} else {
// Check context and load appropriate blueprint
context := b.contextHandler.GetContext()
if strings.HasPrefix(context, "local") && len(yamlData) == 0 {
if strings.HasPrefix(context, "local") {
// Load local.jsonnet as blueprint
evaluatedJsonnet, err := generateBlueprintFromJsonnet(b.configHandler.GetConfig(), localJsonnetTemplate)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion pkg/generators/git_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/fs"
"os"
"path/filepath"
"strings"
"testing"
)

Expand Down Expand Up @@ -86,12 +87,17 @@ func TestGitGenerator_Write(t *testing.T) {
t.Fatalf("expected no error, got %v", err)
}

// Normalize line endings for cross-platform compatibility
normalizeLineEndings := func(content string) string {
return strings.ReplaceAll(content, "\r\n", "\n")
}

// Check if osWriteFile was called with the correct parameters
if filepath.ToSlash(capturedFilename) != gitGenTestMockGitignorePath {
t.Errorf("expected filename %s, got %s", gitGenTestMockGitignorePath, capturedFilename)
}

if string(capturedContent) != gitGenTestExpectedContent {
if normalizeLineEndings(string(capturedContent)) != normalizeLineEndings(gitGenTestExpectedContent) {
t.Errorf("expected content %s, got %s", gitGenTestExpectedContent, string(capturedContent))
}

Expand Down
Loading