Skip to content

Commit

Permalink
add support for the multiple linux architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoCaso committed May 22, 2024
1 parent b9fe2e7 commit 61770a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/serverless/dependency_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
package main

import (
"fmt"
"os"
"os/exec"
"runtime"
"strings"
"testing"

"github.com/stretchr/testify/assert"
)

const erroMsg = `
The dependencies.txt file is out of date. Please run: CGO_ENABLED=1 GOOS=linux go list -f '{{join .Deps "\n"}}' -tags serverless github.com/DataDog/datadog-agent/cmd/serverless > cmd/serverless/dependencies.txt to update it
The %s_dependencies_%s.txt file is out of date.
Update the file locally with this content:
%s
`

func buildDependencyList() (string, error) {
Expand All @@ -41,11 +45,13 @@ func buildDependencyList() (string, error) {
func TestImportPackage(t *testing.T) {
dependencyList, err := buildDependencyList()
assert.NoError(t, err)
data, err := os.ReadFile("dependencies.txt")
file := fmt.Sprintf("%s_dependencies_%s.txt", runtime.GOOS, runtime.GOARCH)

data, err := os.ReadFile(file)
assert.NoError(t, err)

cleanDependencyList := strings.TrimLeft(dependencyList, "\"")
cleanDependencyList = strings.TrimRight(cleanDependencyList, "\"\n")
cleanDependencyList += "\n"
assert.Equal(t, string(data), cleanDependencyList, erroMsg)
assert.Equal(t, string(data), cleanDependencyList, fmt.Sprintf(erroMsg, runtime.GOOS, runtime.GOARCH, cleanDependencyList))
}
File renamed without changes.
Empty file.

0 comments on commit 61770a0

Please sign in to comment.