Skip to content

Commit 0878a11

Browse files
committed
Added check used to test if Vault version is greater than specified version
1 parent 723dc00 commit 0878a11

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/test/java/io/github/jopenlibs/vault/util/VaultVersion.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ public static boolean lessThan(String version) {
6464
}
6565
}
6666

67+
public static boolean greatThan(String version) {
68+
VaultVersion accepted = new VaultVersion(version);
69+
try {
70+
VaultVersion current = new VaultVersion(
71+
Optional.ofNullable(System.getenv("VAULT_VERSION")).orElse("latest"));
72+
73+
if (current.getLiteral().equals("latest")) {
74+
return false;
75+
}
76+
77+
if (current.compareTo(accepted) <= 0) {
78+
return false;
79+
}
80+
81+
return true;
82+
} catch (NumberFormatException ignored) {
83+
return false;
84+
}
85+
}
86+
6787
@Override
6888
public String toString() {
6989
return this.getLiteral();

0 commit comments

Comments
 (0)