Skip to content

Conversation

@tristanreid
Copy link

Per #132, this PR adds user and password options. If these options are present and the user/password are still in the URL, an exception is thrown with a clear error message.

Unit tests are still pending - maybe it's better to check for ambiguous parameters in the Parameter class instead, to make it easier to test? Glad for any other feedback as well!

@JoshRosen
Copy link
Contributor

@tristanreid, great idea regarding doing the validation in the Parameter itself; it looks like we already do this to some degree, so it should be a small change to do it there: https://github.com/tristanreid/spark-redshift/blob/5210e7ea1169c1351fc6897082cdd3d347a81a2b/src/main/scala/com/databricks/spark/redshift/Parameters.scala#L55

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor style nit, but I'd probably change the comma to a semicolon.

@JoshRosen
Copy link
Contributor

By the way, this looks good overall; my review comments above are mostly minor nits and should be easy to address; no fundamental code changes needed.

@tristanreid
Copy link
Author

Thanks for the great feedback, Josh. I can get that unit test worked out in the next day or so if you don't get to it.

@JoshRosen
Copy link
Contributor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use if (credsInURL.isDefined) here.

@JoshRosen
Copy link
Contributor

Whoops, missed your commit comment earlier. Aside from the minor style nits above, this change looks good to me.

@tristanreid
Copy link
Author

Thanks for the great feedback on this! Should be good to go. By the way, is there a lint / stylechecker available for the Databricks style guide? If not, the rules look pretty easy for me to add on my own, I'm just being lazy (as a good programmer should, of course).

@JoshRosen JoshRosen added this to the 0.6.1 milestone Jan 26, 2016
@JoshRosen JoshRosen self-assigned this Jan 26, 2016
@JoshRosen JoshRosen closed this Jan 26, 2016
@JoshRosen JoshRosen reopened this Jan 26, 2016
@JoshRosen
Copy link
Contributor

(Closed and re-opened to trigger Travis)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scalastyle is complaining about this:

[error] /home/travis/build/databricks/spark-redshift/src/main/scala/com/databricks/spark/redshift/Parameters.scala:66:11: No space after token if

@JoshRosen
Copy link
Contributor

Looks like I had Travis disabled for PRs, but should be fixed now.

@codecov-io
Copy link

Current coverage is 87.53%

Merging #162 into master will decrease coverage by -1.44% as of fcf1526

@@            master    #162   diff @@
======================================
  Files           13      13       
  Stmts          644     658    +14
  Branches       142     146     +4
  Methods          0       0       
======================================
+ Hit            573     576     +3
  Partial          0       0       
- Missed          71      82    +11

Review entire Coverage Diff as of fcf1526

Powered by Codecov. Updated on successful CI builds.

@JoshRosen
Copy link
Contributor

(Triggering end-to-end integration tests)

@JoshRosen
Copy link
Contributor

Weird:

[info] Exception encountered when attempting to run a suite with class name: com.databricks.spark.redshift.DecimalIntegrationSuite *** ABORTED ***
[info]   scala.MatchError: None (of class scala.None$)
[info]   at com.databricks.spark.redshift.JDBCWrapper.getConnector(RedshiftJDBCWrapper.scala:229)
[info]   at com.databricks.spark.redshift.IntegrationSuiteBase$class.beforeAll(IntegrationSuiteBase.scala:91)
[info]   at com.databricks.spark.redshift.DecimalIntegrationSuite.beforeAll(DecimalIntegrationSuite.scala:25)
[info]   at org.scalatest.BeforeAndAfterAll$class.beforeAll(BeforeAndAfterAll.scala:187)
[info]   at com.databricks.spark.redshift.DecimalIntegrationSuite.beforeAll(DecimalIntegrationSuite.scala:25)
[info]   at org.scalatest.BeforeAndAfterAll$class.run(BeforeAndAfterAll.scala:253)
[info]   at com.databricks.spark.redshift.DecimalIntegrationSuite.run(DecimalIntegrationSuite.scala:25)
[info]   at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:462)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:671)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:296)
[info]   at sbt.ForkMain$Run$2.call(ForkMain.java:286)
[info]   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
[info]   at java.util.concurrent.FutureTask.run(FutureTask.java:166)
[info]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
[info]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[info]   at java.lang.Thread.run(Thread.java:701)

@tristanreid
Copy link
Author

Ugh...sorry it's taking so many iterations. I don't have the environment to run the integration tests at the moment (in particular the AWS session token)

@tristanreid
Copy link
Author

Is this good to go?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use credentials.foreach { case (user, password => } instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@JoshRosen
Copy link
Contributor

I'll try to take another look later today

@tristanreid
Copy link
Author

Hey Josh,
Any thoughts or changes? Thanks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to codecov, it looks like this was never actually hit during tests. I'm going to go ahead and merge this now and will add an end-to-end test myself in a followup patch.

@JoshRosen
Copy link
Contributor

This looks fine to me. There's one extra test that I would add, but I can do it myself in a followup. Thanks!

@JoshRosen JoshRosen closed this in 65999ea Jan 30, 2016
JoshRosen added a commit that referenced this pull request Jan 30, 2016
…ather than URI

Followup to #162 to add a roundtrip test case in order to improve code coverage.

Author: Josh Rosen <joshrosen@databricks.com>

Closes #166 from JoshRosen/more-credential-tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants