mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-28 12:56:46 -08:00
Merge pull request #322 from element-hq/gaelg/ess-helm-fix
matrix-tools: fix lint
This commit is contained in:
7 files changed
+27
-9
No files matched your search
@@ -58,7 +58,7 @@ func readfile(path string) (string, error) {
|
||||
}
|
||||
|
||||
func replace(old, new, src string) string {
|
||||
return strings.Replace(src, old, new, -1)
|
||||
return strings.ReplaceAll(src, old, new)
|
||||
}
|
||||
|
||||
func quote(src string) string {
|
||||
@@ -126,7 +126,7 @@ func RenderConfig(sourceConfigs []io.Reader) (map[string]any, error) {
|
||||
if os.Getenv("DEBUG_RENDERING") == "1" {
|
||||
fmt.Println(string(fileContent))
|
||||
}
|
||||
return nil, fmt.Errorf("Post-processed YAML is invalid: %v", err)
|
||||
return nil, fmt.Errorf("post-processed yaml is invalid: %v", err)
|
||||
}
|
||||
|
||||
if err := deepMergeMaps(data, output); err != nil {
|
||||
|
||||
@@ -166,7 +166,9 @@ anotherKey:
|
||||
t.Errorf("expected: %v, got: %v", tc.expected, result)
|
||||
}
|
||||
for k := range tc.env {
|
||||
os.Unsetenv(k)
|
||||
if err := os.Unsetenv(k); err != nil {
|
||||
t.Errorf("Failed to unset environment variable %s: %v", k, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func GenerateSecret(client kubernetes.Interface, secretLabels map[string]string,
|
||||
return fmt.Errorf("failed to initialize secret: %w", err)
|
||||
}
|
||||
} else {
|
||||
if managedBy, ok := existingSecret.ObjectMeta.Labels["app.kubernetes.io/managed-by"]; ok {
|
||||
if managedBy, ok := existingSecret.Labels["app.kubernetes.io/managed-by"]; ok {
|
||||
if managedBy != "matrix-tools-init-secrets" {
|
||||
return fmt.Errorf("secret %s/%s is not managed by this matrix-tools-init-secrets", namespace, name)
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func GenerateSecret(client kubernetes.Interface, secretLabels map[string]string,
|
||||
return fmt.Errorf("secret %s/%s is not managed by this matrix-tools-init-secrets", namespace, name)
|
||||
}
|
||||
// Make sure the labels are set correctly
|
||||
existingSecret.ObjectMeta.Labels = secretLabels
|
||||
existingSecret.Labels = secretLabels
|
||||
}
|
||||
|
||||
// Add or update the key in the data
|
||||
|
||||
@@ -157,7 +157,7 @@ func TestGenerateSecret(t *testing.T) {
|
||||
t.Errorf("Expected key to be set in the secret")
|
||||
}
|
||||
|
||||
labels := secret.ObjectMeta.Labels
|
||||
labels := secret.Labels
|
||||
if tc.secretData == nil {
|
||||
if !reflect.DeepEqual(labels, tc.secretLabels) {
|
||||
t.Fatalf("The secret has been created without the labels: %v", labels)
|
||||
|
||||
@@ -7,6 +7,7 @@ package tcpwait
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -18,7 +19,12 @@ func WaitForTCP(address string) {
|
||||
if err != nil {
|
||||
time.Sleep(time.Second)
|
||||
} else {
|
||||
defer conn.Close()
|
||||
defer func() {
|
||||
if err = conn.Close(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package tcpwait
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"testing"
|
||||
)
|
||||
@@ -16,7 +17,11 @@ func TestTCPWait(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start listener: %v", err)
|
||||
}
|
||||
defer listener.Close()
|
||||
defer func() {
|
||||
if err = listener.Close(); err != nil {
|
||||
t.Fatalf("Failed to close listener: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Get the address of the local TCP server
|
||||
serverAddr := listener.Addr().String()
|
||||
@@ -28,7 +33,11 @@ func TestTCPWait(t *testing.T) {
|
||||
t.Errorf("Accept error: %v", err)
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
defer func() {
|
||||
if err = conn.Close(); err != nil {
|
||||
fmt.Printf("Close error: %v", err)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
// Call the tcpwait function with the server address and timeout
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
matrix-tools: Various internal fixes after upgrading linter.
|
||||
Reference in new issue
Block a user