-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Redis support for SSL and password (#717)
Signed-off-by: munishchouhan <[email protected]> Signed-off-by: Paolo Di Tommaso <[email protected]> Co-authored-by: Paolo Di Tommaso <[email protected]>
- Loading branch information
1 parent
63ff591
commit bf63599
Showing
4 changed files
with
108 additions
and
8 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
62 changes: 62 additions & 0 deletions
62
src/test/groovy/io/seqera/wave/redis/RedisFactoryTest.groovy
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,62 @@ | ||
/* | ||
* Wave, containers provisioning service | ||
* Copyright (c) 2023-2024, Seqera Labs | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.seqera.wave.redis | ||
|
||
import spock.lang.Specification | ||
|
||
import redis.clients.jedis.exceptions.InvalidURIException | ||
/** | ||
* | ||
* @author Munish Chouhan <[email protected]> | ||
*/ | ||
class RedisFactoryTest extends Specification { | ||
def 'should create redis pool with valid URI'() { | ||
given: | ||
def factory = new RedisFactory() | ||
|
||
when: | ||
def pool = factory.createRedisPool(URI_STRING, MIN_IDLE, MAX_IDLE, MAX_TOTAL, TIMEOUT, 'password') | ||
|
||
then: | ||
pool != null | ||
|
||
where: | ||
URI_STRING | MIN_IDLE | MAX_IDLE | MAX_TOTAL | TIMEOUT | ||
'redis://localhost:6379' | 0 | 10 | 50 | 5000 | ||
'rediss://localhost:6379'| 1 | 5 | 20 | 3000 | ||
} | ||
|
||
def 'should throw exception for invalid URI'() { | ||
given: | ||
def factory = new RedisFactory() | ||
|
||
when: | ||
factory.createRedisPool(URI_STRING, MIN_IDLE, MAX_IDLE, MAX_TOTAL, TIMEOUT, null) | ||
|
||
then: | ||
def e = thrown(InvalidURIException) | ||
e.message.contains("Invalid Redis connection URI: $URI_STRING") | ||
|
||
where: | ||
URI_STRING | MIN_IDLE | MAX_IDLE | MAX_TOTAL | TIMEOUT | ||
'redis://localhost' | 0 | 10 | 50 | 5000 | ||
'localhost:6379' | 1 | 5 | 20 | 3000 | ||
} | ||
|
||
} |