Skip to content

Commit

Permalink
Updating README and examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
stewartbryson authored and github-actions[bot] committed Apr 7, 2023
1 parent 53437af commit 00ea602
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 12 deletions.
63 changes: 57 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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'
}
```

Expand Down Expand Up @@ -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
Expand All @@ -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'
}
```

Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/groovy/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/java-external-stage/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/java-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
Expand Down
2 changes: 1 addition & 1 deletion examples/java/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion examples/scala/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 00ea602

Please sign in to comment.