Skip to content
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 internal/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func getLogWritter(path string) (io.WriteCloser, error) {
}
}

_, err = lf.WriteString(fmt.Sprintf("container-suseconnect %s\n", Version))
_, err = fmt.Fprintf(lf, "container-suseconnect %s\n", Version)
if err != nil {
lf.Close()
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions internal/regionsrv/hostsfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ func TestUpdateHostsFileSuccessful(t *testing.T) {
defer os.Remove(hostsFile)

before, err := os.ReadFile(hostsFile)
if err != nil {
t.Fatalf("os.ReadFile failed with: %v", err)
}

err = UpdateHostsFile("test-hostname", "1.1.1.1")
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/regionsrv/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func (ts *testServer) run() (err error) {

conn, err := ts.server.Accept()
if err != nil {
err = errors.New("could not accept connection")
break
}

Expand Down
6 changes: 3 additions & 3 deletions internal/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func testServiceOutput(

products, err := parseProducts(reader)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
}
if len(products) != 1 {
t.Fatalf("Unexpected number of products found. Got %d, expected %d", len(products), 1)
Expand All @@ -47,7 +47,7 @@ func testServiceOutput(

result := buf.String()
if result != expectedOutput {
t.Errorf(result)
t.Error(result)
}

file, err := os.Create("result.txt")
Expand All @@ -56,7 +56,7 @@ func testServiceOutput(
}
defer file.Close()

fmt.Fprintf(file, result)
fmt.Fprint(file, result)
}

func TestServiceOutputSLE12(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func shouldHaveLogged(t *testing.T, str string) {
}

// The logged string includes the timestamp, get rid of it.
re := regexp.MustCompile("^\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}\\s")
re := regexp.MustCompile(`^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}\s`)
logStr := strings.TrimSpace(re.ReplaceAllString(original, ""))

if strings.TrimSpace(str) != logStr {
Expand Down
7 changes: 4 additions & 3 deletions internal/suseconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ func (data *SUSEConnectData) onLocationsNotFound() bool {
}

func (data *SUSEConnectData) setValues(key, value string) {
if key == "url" {
switch key {
case "url":
data.SccURL = value
} else if key == "insecure" {
case "insecure":
data.Insecure = value == "true"
} else {
default:
log.Printf("Warning: Unknown key '%v'", key)
}
}
Expand Down