build(deps): bump github.com/testcontainers/testcontainers-go/modules/opensearch
Bumps [github.com/testcontainers/testcontainers-go/modules/opensearch](https://github.com/testcontainers/testcontainers-go) from 0.38.0 to 0.39.0. - [Release notes](https://github.com/testcontainers/testcontainers-go/releases) - [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.38.0...v0.39.0) --- updated-dependencies: - dependency-name: github.com/testcontainers/testcontainers-go/modules/opensearch dependency-version: 0.39.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
76ac20e9e8
commit
ca2636b653
+4
-4
@@ -115,7 +115,7 @@ func ReadLines(filename string) ([]string, error) {
|
||||
}
|
||||
|
||||
// ReadLine reads a file and returns the first occurrence of a line that is prefixed with prefix.
|
||||
func ReadLine(filename string, prefix string) (string, error) {
|
||||
func ReadLine(filename, prefix string) (string, error) {
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -156,7 +156,7 @@ func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error) {
|
||||
for i := uint(0); i < uint(n)+offset || n < 0; i++ {
|
||||
line, err := r.ReadString('\n')
|
||||
if err != nil {
|
||||
if err == io.EOF && len(line) > 0 {
|
||||
if err == io.EOF && line != "" {
|
||||
ret = append(ret, strings.Trim(line, "\n"))
|
||||
}
|
||||
break
|
||||
@@ -349,7 +349,7 @@ func PathExistsWithContents(filename string) bool {
|
||||
|
||||
// GetEnvWithContext retrieves the environment variable key. If it does not exist it returns the default.
|
||||
// The context may optionally contain a map superseding os.EnvKey.
|
||||
func GetEnvWithContext(ctx context.Context, key string, dfault string, combineWith ...string) string {
|
||||
func GetEnvWithContext(ctx context.Context, key, dfault string, combineWith ...string) string {
|
||||
var value string
|
||||
if env, ok := ctx.Value(common.EnvKey).(common.EnvMap); ok {
|
||||
value = env[common.EnvKeyType(key)]
|
||||
@@ -365,7 +365,7 @@ func GetEnvWithContext(ctx context.Context, key string, dfault string, combineWi
|
||||
}
|
||||
|
||||
// GetEnv retrieves the environment variable key. If it does not exist it returns the default.
|
||||
func GetEnv(key string, dfault string, combineWith ...string) string {
|
||||
func GetEnv(key, dfault string, combineWith ...string) string {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
value = dfault
|
||||
|
||||
+2
-2
@@ -317,11 +317,11 @@ func VirtualizationWithContext(ctx context.Context) (string, string, error) {
|
||||
return system, role, nil
|
||||
}
|
||||
|
||||
func GetOSRelease() (platform string, version string, err error) {
|
||||
func GetOSRelease() (platform, version string, err error) {
|
||||
return GetOSReleaseWithContext(context.Background())
|
||||
}
|
||||
|
||||
func GetOSReleaseWithContext(ctx context.Context) (platform string, version string, err error) {
|
||||
func GetOSReleaseWithContext(ctx context.Context) (platform, version string, err error) {
|
||||
contents, err := ReadLines(HostEtcWithContext(ctx, "os-release"))
|
||||
if err != nil {
|
||||
return "", "", nil // return empty
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ func CallLsofWithContext(ctx context.Context, invoke Invoker, pid int32, args ..
|
||||
|
||||
var ret []string
|
||||
for _, l := range lines[1:] {
|
||||
if len(l) == 0 {
|
||||
if l == "" {
|
||||
continue
|
||||
}
|
||||
ret = append(ret, l)
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var bufferPool = sync.Pool{
|
||||
New: func() any {
|
||||
b := make([]byte, syscall.PathMax)
|
||||
return &b
|
||||
},
|
||||
}
|
||||
|
||||
// The following three functions are copied from stdlib.
|
||||
|
||||
// ignoringEINTR2 is ignoringEINTR, but returning an additional value.
|
||||
func ignoringEINTR2[T any](fn func() (T, error)) (T, error) {
|
||||
for {
|
||||
v, err := fn()
|
||||
if !errors.Is(err, syscall.EINTR) {
|
||||
return v, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Many functions in package syscall return a count of -1 instead of 0.
|
||||
// Using fixCount(call()) instead of call() corrects the count.
|
||||
func fixCount(n int, err error) (int, error) {
|
||||
if n < 0 {
|
||||
n = 0
|
||||
}
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Readlink behaves like os.Readlink but caches the buffer passed to syscall.Readlink.
|
||||
func Readlink(name string) (string, error) {
|
||||
b := bufferPool.Get().(*[]byte)
|
||||
|
||||
n, err := ignoringEINTR2(func() (int, error) {
|
||||
return fixCount(syscall.Readlink(name, *b))
|
||||
})
|
||||
if err != nil {
|
||||
bufferPool.Put(b)
|
||||
return "", &os.PathError{Op: "readlink", Path: name, Err: err}
|
||||
}
|
||||
|
||||
result := string((*b)[:n])
|
||||
bufferPool.Put(b)
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user