ROOTPLOIT
Server: LiteSpeed
System: Linux in-mum-web1878.main-hosting.eu 5.14.0-570.21.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 11 07:22:35 EDT 2025 x86_64
User: u435929562 (435929562)
PHP: 7.4.33
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/go/pkg/mod/github.com/aws/[email protected]/aws/config_test.go
package aws

import (
	"net/http"
	"reflect"
	"testing"

	"github.com/aws/aws-sdk-go/aws/credentials"
)

var testCredentials = credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")

var copyTestConfig = Config{
	Credentials:             testCredentials,
	Endpoint:                String("CopyTestEndpoint"),
	Region:                  String("COPY_TEST_AWS_REGION"),
	DisableSSL:              Bool(true),
	HTTPClient:              http.DefaultClient,
	LogLevel:                LogLevel(LogDebug),
	Logger:                  NewDefaultLogger(),
	MaxRetries:              Int(3),
	DisableParamValidation:  Bool(true),
	DisableComputeChecksums: Bool(true),
	S3ForcePathStyle:        Bool(true),
}

func TestCopy(t *testing.T) {
	want := copyTestConfig
	got := copyTestConfig.Copy()
	if !reflect.DeepEqual(*got, want) {
		t.Errorf("Copy() = %+v", got)
		t.Errorf("    want %+v", want)
	}

	got.Region = String("other")
	if got.Region == want.Region {
		t.Errorf("Expect setting copy values not not reflect in source")
	}
}

func TestCopyReturnsNewInstance(t *testing.T) {
	want := copyTestConfig
	got := copyTestConfig.Copy()
	if got == &want {
		t.Errorf("Copy() = %p; want different instance as source %p", got, &want)
	}
}

var mergeTestZeroValueConfig = Config{}

var mergeTestConfig = Config{
	Credentials:                    testCredentials,
	Endpoint:                       String("MergeTestEndpoint"),
	Region:                         String("MERGE_TEST_AWS_REGION"),
	DisableSSL:                     Bool(true),
	HTTPClient:                     http.DefaultClient,
	LogLevel:                       LogLevel(LogDebug),
	Logger:                         NewDefaultLogger(),
	MaxRetries:                     Int(10),
	DisableParamValidation:         Bool(true),
	DisableComputeChecksums:        Bool(true),
	DisableEndpointHostPrefix:      Bool(true),
	EnableEndpointDiscovery:        Bool(true),
	EnforceShouldRetryCheck:        Bool(true),
	DisableRestProtocolURICleaning: Bool(true),
	S3ForcePathStyle:               Bool(true),
	LowerCaseHeaderMaps:            Bool(true),
}

var mergeTests = []struct {
	cfg  *Config
	in   *Config
	want *Config
}{
	{&Config{}, nil, &Config{}},
	{&Config{}, &mergeTestZeroValueConfig, &Config{}},
	{&Config{}, &mergeTestConfig, &mergeTestConfig},
}

func TestMerge(t *testing.T) {
	for i, tt := range mergeTests {
		got := tt.cfg.Copy()
		got.MergeIn(tt.in)
		if !reflect.DeepEqual(got, tt.want) {
			t.Errorf("Config %d %+v", i, tt.cfg)
			t.Errorf("   Merge(%+v)", tt.in)
			t.Errorf("     got %+v", got)
			t.Errorf("    want %+v", tt.want)
		}
	}
}