-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from nebula-contrib/upgrade-client
upgrade client to 3.6.1 and use testcontainers-neubula
- Loading branch information
Showing
13 changed files
with
182 additions
and
80 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package zio.nebula | ||
|
||
import zio._ | ||
import zio.nebula.meta.NebulaMetaClient | ||
import zio.nebula.net.NebulaClient | ||
import zio.nebula.storage.NebulaStorageClient | ||
|
||
/** | ||
* This is the default configuration dedicated to testing. | ||
* | ||
* @author | ||
* 梦境迷离 | ||
* @version 1.0,2023/9/19 | ||
*/ | ||
object ZioNebulaEnvironment { | ||
|
||
var defaultUser = "root" | ||
var defaultPwd = "nebula" | ||
var defaultSpace = "test" | ||
|
||
def defaultSession(host: String, port: Int): ZLayer[Scope, Throwable, SessionClient] = | ||
ZLayer.makeSome[Scope, SessionClient]( | ||
NebulaSessionClient.layer, | ||
ZLayer.succeed( | ||
NebulaSessionPoolConfig( | ||
List(NebulaHostAddress(host, port)), | ||
NebulaAuth(defaultUser, defaultPwd), | ||
defaultSpace | ||
) | ||
) | ||
) | ||
|
||
def defaultClient(host: String, port: Int): ZLayer[Scope, Throwable, Client] = | ||
NebulaClient.layer ++ ZLayer.succeed( | ||
NebulaPoolConfig( | ||
timeoutMills = 60000, | ||
enableSsl = false, | ||
minConnsSize = 10, | ||
maxConnsSize = 10, | ||
intervalIdleMills = 100, | ||
waitTimeMills = 100, | ||
sslParam = None | ||
) | ||
) ++ ZLayer.fromZIO( | ||
ZIO.attempt( | ||
NebulaSessionPoolConfig( | ||
List(NebulaHostAddress(host, port)), | ||
NebulaAuth(defaultUser, defaultPwd), | ||
defaultSpace | ||
) | ||
) | ||
) | ||
|
||
def defaultStorage(host: String, port: Int): ZLayer[Scope, Throwable, Storage] = | ||
ZLayer.makeSome[Scope, Storage]( | ||
NebulaStorageClient.layer, | ||
ZLayer.succeed( | ||
NebulaStorageConfig( | ||
NebulaConfig( | ||
List(NebulaHostAddress(host, port)), | ||
30000, | ||
3, | ||
3 | ||
) | ||
) | ||
) | ||
) | ||
|
||
def defaultMeta(host: String, port: Int): ZLayer[Scope, Throwable, Meta] = | ||
ZLayer.makeSome[Scope, Meta]( | ||
NebulaMetaClient.layer, | ||
ZLayer.succeed( | ||
NebulaMetaConfig( | ||
NebulaConfig( | ||
List(NebulaHostAddress(host, port)), | ||
30000, | ||
3, | ||
3 | ||
) | ||
) | ||
) | ||
) | ||
|
||
} |
Oops, something went wrong.