MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / checkConnection

Function checkConnection

driver/oss/s3_test.go:227–245  ·  view source on GitHub ↗

checkConnection returns true if a connection could be made, false otherwise.

()

Source from the content-addressed store, hash-verified

225
226// checkConnection returns true if a connection could be made, false otherwise.
227func checkConnection() bool {
228 os.Setenv("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE")
229 os.Setenv("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
230 // No S3ForcePathStyle required because we're not accessing a specific bucket here.
231 sess, err := session.NewSession(aws.NewConfig().WithRegion(endpoints.UsEast1RegionID).WithEndpoint(customEndpoint))
232 if err != nil {
233 log.Printf("An error occurred during testing the connection to the server: %v\n", err)
234 return false
235 }
236 svc := awss3.New(sess)
237
238 _, err = svc.ListBuckets(&awss3.ListBucketsInput{})
239 if err != nil {
240 log.Printf("An error occurred during testing the connection to the server: %v\n", err)
241 return false
242 }
243
244 return true
245}
246
247func createClient(t *testing.T, codec encoding.Codec) oss.Client {
248 // os.Setenv("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE")

Callers 6

TestClientFunction · 0.85
TestTypesFunction · 0.85
TestClientConcurrentFunction · 0.85
TestErrorsFunction · 0.85
TestNilFunction · 0.85
TestCloseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected