diff --git a/README.md b/README.md index 5765368..b028ebc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ We introduced breaking changes in version `2.0.0` described below. ### SnowSQL Config File -Instead of continuing to use plugin DSL or Gradle properties to provide Snowflake authentication, I made the +Instead of continuing to use plugin DSL or Gradle properties to provide Snowflake authentication, we made the decision to switch to using the SnowSQL config moving forward. This was inspired by the [Snowflake Developer CLI](https://github.com/Snowflake-Labs/snowcli) project, and it seems to be a reasonable standard moving forward. @@ -79,7 +79,7 @@ is automatically applied by the `snowflake` plugin: ```groovy plugins { id 'java' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } ``` @@ -210,7 +210,7 @@ BUILD SUCCESSFUL in 624ms This project uses the [S3 Gradle build cache plugin](https://github.com/burrunan/gradle-s3-build-cache) and we are very happy with it. -Check the [Gradle settings file](setting.gradle) for an implementation example. +Check the [Gradle settings file](settings.gradle) for an implementation example. # Testing Gradle @@ -235,7 +235,7 @@ Our `plugins` DSL from the build file: plugins { id 'java' id 'groovy' // needed for Spock testing framework - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } ``` @@ -279,7 +279,20 @@ All unit tests in either `src/test/java` (written using JUnit or something else) we automatically run whenever the `test` or `build` task is executed. ```shell -./gradlew build +❯ ./gradlew build + +> Task :test + +SampleTest + + Test adding 1 and 2 PASSED + Test adding 3 and 4 PASSED + +SUCCESS: Executed 2 tests in 487ms + + +BUILD SUCCESSFUL in 1s +9 actionable tasks: 5 executed, 4 up-to-date ``` All Gradle testing tasks are automatically incremental and cacheable, and would be avoided if executed again without changes to the code in either the source or the spec. @@ -299,7 +312,7 @@ functionalTest(JvmTestSuite) { all { useSpock('2.3-groovy-3.0') dependencies { - implementation "io.github.stewartbryson:gradle-snowflake-plugin:2.0.1" + implementation "io.github.stewartbryson:gradle-snowflake-plugin:2.0.2" } testTask.configure { failFast true @@ -352,6 +365,44 @@ class SnowflakeSampleTest extends SnowflakeSpec { The `selectSingleValue` method returns the first column from the first row in a `SELECT` statement, so it's perfect for testing a function. And of course, this executes against Snowflake in real time. +```shell +❯ ./gradlew functionalTest + +> Task :test + +SampleTest + + Test adding 1 and 2 PASSED + Test adding 3 and 4 PASSED + +SUCCESS: Executed 2 tests in 462ms + + +> Task :snowflakeJvm +Using snowsql config file: /Users/stewartbryson/.snowsql/config +File java-testing-0.1.0-all.jar: UPLOADED +Deploying ==> +CREATE OR REPLACE function add_numbers (a integer, b integer) + returns string + language JAVA + handler = 'Sample.addNum' + imports = ('@upload/libs/java-testing-0.1.0-all.jar') + + +> Task :functionalTest + +SnowflakeSampleTest + + Test ADD_NUMBERS() function with 1 and 2 PASSED + Test ADD_NUMBERS() function with 3 and 4 PASSED + +SUCCESS: Executed 2 tests in 3.4s + + +BUILD SUCCESSFUL in 9s +11 actionable tasks: 7 executed, 4 up-to-date +``` + ### Testing with Ephemeral Database Clones Running functional tests using static Snowflake databases is boring, especially considering the [zero-copy cloning](https://docs.snowflake.com/en/user-guide/object-clone.html#cloning-considerations) functionality diff --git a/examples/groovy/build.gradle b/examples/groovy/build.gradle index 227f9ee..ab13d52 100644 --- a/examples/groovy/build.gradle +++ b/examples/groovy/build.gradle @@ -1,7 +1,7 @@ plugins { id 'groovy' id 'com.github.ben-manes.versions' version '0.46.0' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } repositories { diff --git a/examples/java-external-stage/build.gradle b/examples/java-external-stage/build.gradle index 6f056cc..4299b30 100644 --- a/examples/java-external-stage/build.gradle +++ b/examples/java-external-stage/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'com.github.ben-manes.versions' version '0.46.0' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } repositories { diff --git a/examples/java-testing/build.gradle b/examples/java-testing/build.gradle index 63a8139..c05ba7f 100644 --- a/examples/java-testing/build.gradle +++ b/examples/java-testing/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'groovy' // needed for Spock testing framework - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' id 'com.adarshr.test-logger' version '3.2.0' // added for testing id 'com.github.ben-manes.versions' version '0.46.0' } diff --git a/examples/java/build.gradle b/examples/java/build.gradle index ff0606f..0305be8 100644 --- a/examples/java/build.gradle +++ b/examples/java/build.gradle @@ -1,7 +1,7 @@ plugins { id 'java' id 'com.github.ben-manes.versions' version '0.46.0' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } repositories { diff --git a/examples/kotlin/build.gradle b/examples/kotlin/build.gradle index b76bc25..6ec21a0 100644 --- a/examples/kotlin/build.gradle +++ b/examples/kotlin/build.gradle @@ -1,7 +1,7 @@ plugins { id "org.jetbrains.kotlin.jvm" version "1.7.21" id 'com.github.ben-manes.versions' version '0.46.0' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } repositories { diff --git a/examples/scala/build.gradle b/examples/scala/build.gradle index b87e7ea..f84cbc6 100644 --- a/examples/scala/build.gradle +++ b/examples/scala/build.gradle @@ -1,7 +1,7 @@ plugins { id 'scala' id 'com.github.ben-manes.versions' version '0.46.0' - id 'io.github.stewartbryson.snowflake' version '2.0.1' + id 'io.github.stewartbryson.snowflake' version '2.0.2' } repositories {