-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-830955 Use default SDK version in User-Agent
While constructing HTTP User-Agent header, take the SDK version from code instead from a file on classpath. It is less prone to accidental classpath overrides. The consequence of this is that we must now keep the DEFAULT_VERSION in sync with the project version defined in Maven, which we are doing already anyway (a new test has been added to verify this).
- Loading branch information
1 parent
9d1ab3d
commit e126bc8
Showing
3 changed files
with
21 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/java/net/snowflake/ingest/connection/UserAgentTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package net.snowflake.ingest.connection; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
import net.snowflake.ingest.SimpleIngestManager; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class UserAgentTest { | ||
@Test | ||
public void testDefaultSdkVersionMatchesProjectVersion() throws IOException { | ||
Properties properties = new Properties(); | ||
try (InputStream is = | ||
SimpleIngestManager.class.getClassLoader().getResourceAsStream("project.properties")) { | ||
properties.load(is); | ||
Assert.assertEquals(RequestBuilder.DEFAULT_VERSION, properties.getProperty("version")); | ||
} | ||
} | ||
} |