zeroshade commented on code in PR #1207:
URL: https://github.com/apache/arrow-adbc/pull/1207#discussion_r1362279159
##########
go/adbc/driver/snowflake/driver_test.go:
##########
@@ -672,3 +676,88 @@ func (suite *SnowflakeTests) TestUseHighPrecision() {
suite.Equal(1234567.89, rec.Column(1).(*array.Float64).Value(0))
suite.Equal(9876543210.99, rec.Column(1).(*array.Float64).Value(1))
}
+
+func TestUnencryptedJwtAuthenticationUsingString(t *testing.T) {
+ drv := gosnowflake.SnowflakeDriver{}
+
+ uri, ok := os.LookupEnv("SNOWFLAKE_URI")
+
+ if !ok {
+ panic("Cannot find the `SNOWFLAKE_URI` value")
+ }
+
+ cfg, _ := gosnowflake.ParseDSN(uri)
+ cfg.Authenticator = gosnowflake.AuthTypeJwt
+
+ keyValue, ok := os.LookupEnv("SNOWFLAKE_TEST_PKCS8_VALUE")
+
+ if !ok {
+ panic("Cannot find the `SNOWFLAKE_TEST_PKCS8_VALUE` value")
+ }
+
+ // Windows funkiness
+ if runtime.GOOS == "windows" {
+ keyValue = strings.ReplaceAll(keyValue, "\\r", "\r")
+ keyValue = strings.ReplaceAll(keyValue, "\\n", "\n")
+ }
+
+ block, _ := pem.Decode([]byte(keyValue))
+ privKey, _ := pkcs8.ParsePKCS8PrivateKey(block.Bytes, nil)
+
+ cfg.PrivateKey = privKey.(*rsa.PrivateKey)
+
+ connector := gosnowflake.NewConnector(drv, *cfg)
+ ctx := context.Background()
+
+ _, err := connector.Connect(ctx)
+
+ if err != nil {
+ panic(err)
+ }
Review Comment:
Let's just make this a little bit more readable
```go
if _, err := connector.Connect(context.Background()); err != nil {
panic(err)
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]