Skip to content

Commit dff8957

Browse files
committed
Rename env vars
1 parent f9de127 commit dff8957

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

.example.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ ANCHOR_WALLET="$HOME/.config/solana/id.json"
44
ENABLE_DEBUG_LOGS="true"
55

66
# Enable for testing end-to-end with Relay
7-
# TEST_WITH_RELAY="false"
8-
# LOGIN_EMAIL="<...>"
9-
# LOGIN_PASSWORD="<...>"
7+
# TEST_WITH_INFERENCE_BACKEND="false"
8+
# INFERENCE_LOGIN_EMAIL="<...>"
9+
# INFERENCE_LOGIN_PASSWORD="<...>"
1010
# PREVENT_UNSTAKE="false"
1111
# PREVENT_CLOSE_ACCOUNTS="false"
1212

tests/lib/const.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export const EPOCH_CLAIM_FREQUENCY = process.env.EPOCH_CLAIM_FREQUENCY
2020
? parseInt(process.env.EPOCH_CLAIM_FREQUENCY)
2121
: 1;
2222

23-
export const TEST_WITH_RELAY = process.env.TEST_WITH_RELAY
24-
? process.env.TEST_WITH_RELAY === "true"
23+
export const TEST_WITH_INFERENCE_BACKEND = process.env
24+
.TEST_WITH_INFERENCE_BACKEND
25+
? process.env.TEST_WITH_INFERENCE_BACKEND === "true"
2526
: false;
2627

2728
export const PREVENT_UNSTAKE = process.env.PREVENT_UNSTAKE
@@ -41,9 +42,10 @@ export const API_URL = process.env.API_URL
4142
? process.env.API_URL
4243
: "http://localhost:3001";
4344

44-
export const LOGIN_EMAIL = process.env.LOGIN_EMAIL ?? "";
45+
export const INFERENCE_LOGIN_EMAIL = process.env.INFERENCE_LOGIN_EMAIL ?? "";
4546

46-
export const LOGIN_PASSWORD = process.env.LOGIN_PASSWORD ?? "";
47+
export const INFERENCE_LOGIN_PASSWORD =
48+
process.env.INFERENCE_LOGIN_PASSWORD ?? "";
4749

4850
const PROGRAM_ADMIN_KEYPAIR_STRING = process.env.PROGRAM_ADMIN_KEYPAIR;
4951

tests/lib/trpc.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import type { AxiosRequestConfig, AxiosResponse } from "axios";
33
import axios from "axios";
44
import superjson from "superjson";
55

6-
import { API_URL, LOGIN_EMAIL, LOGIN_PASSWORD } from "@tests/lib/const";
6+
import {
7+
API_URL,
8+
INFERENCE_LOGIN_EMAIL,
9+
INFERENCE_LOGIN_PASSWORD,
10+
} from "@tests/lib/const";
711

812
type ServiceResponse = {
913
status:
@@ -125,7 +129,10 @@ export class TrpcHttpClient {
125129

126130
public async login(): Promise<void> {
127131
try {
128-
const params = { email: LOGIN_EMAIL, password: LOGIN_PASSWORD };
132+
const params = {
133+
email: INFERENCE_LOGIN_EMAIL,
134+
password: INFERENCE_LOGIN_PASSWORD,
135+
};
129136
const response = await this.mutate("user.login", params);
130137
if (response.user && response.token) {
131138
this.token = response.token;

tests/multi-epochs.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
PREVENT_CLOSE_ACCOUNTS,
2020
SHOULD_EXECUTE_MULTIPLE_EPOCH_FINALIZATIONS,
2121
PREVENT_UNSTAKE,
22-
TEST_WITH_RELAY,
22+
TEST_WITH_INFERENCE_BACKEND,
2323
} from "@tests/lib/const";
2424
import type {
2525
ConstructMerkleTreeInput,
@@ -74,7 +74,7 @@ async function getRewardClaimInputs({
7474
epoch,
7575
trpc,
7676
}: GetRewardClaimInputsInput): Promise<GetRewardClaimInputsOutput | null> {
77-
if (TEST_WITH_RELAY) {
77+
if (TEST_WITH_INFERENCE_BACKEND) {
7878
debug(
7979
"- End-to-end test flow is enabled, fetching reward claim eligibility from Relay..."
8080
);
@@ -260,7 +260,7 @@ async function handleAccrueRewardForEpochs({
260260
})
261261
.rpc();
262262

263-
if (TEST_WITH_RELAY) {
263+
if (TEST_WITH_INFERENCE_BACKEND) {
264264
await trpc.insertAndProcessTransactionBySignature(signature);
265265
}
266266

@@ -309,7 +309,7 @@ async function handleAccrueRewardForEpochs({
309309
)
310310
.filter((x) => x != null);
311311

312-
const totalClaimedRewardsForPool = TEST_WITH_RELAY
312+
const totalClaimedRewardsForPool = TEST_WITH_INFERENCE_BACKEND
313313
? rewardClaimsForPool.reduce(
314314
(acc, curr) => acc.add(curr),
315315
new anchor.BN(0)
@@ -422,7 +422,7 @@ describe("multi-epoch lifecycle tests", () => {
422422
const trpc = new TrpcHttpClient();
423423

424424
const handleEpochFinalization = async (epoch: number, counter: number) => {
425-
if (TEST_WITH_RELAY) {
425+
if (TEST_WITH_INFERENCE_BACKEND) {
426426
debug(
427427
`- End-to-end test flow is enabled, submitting epoch finalization request for epoch ${epoch}...`
428428
);
@@ -815,7 +815,7 @@ describe("multi-epoch lifecycle tests", () => {
815815
program = setup.sdk.program;
816816
connection = program.provider.connection;
817817

818-
if (TEST_WITH_RELAY) {
818+
if (TEST_WITH_INFERENCE_BACKEND) {
819819
await trpc.login();
820820
}
821821
});
@@ -2216,7 +2216,7 @@ describe("multi-epoch lifecycle tests", () => {
22162216
});
22172217

22182218
it("Final state validation check", async () => {
2219-
if (!TEST_WITH_RELAY) {
2219+
if (!TEST_WITH_INFERENCE_BACKEND) {
22202220
debug(
22212221
"End-to-end test flow is disabled, skipping final state validation"
22222222
);
@@ -2236,7 +2236,7 @@ describe("multi-epoch lifecycle tests", () => {
22362236
});
22372237

22382238
it("Verify total claimed amounts match total distributed amounts", () => {
2239-
if (TEST_WITH_RELAY) {
2239+
if (TEST_WITH_INFERENCE_BACKEND) {
22402240
debug("Testing with Relay is enabled, skipping final accounting checks");
22412241
return;
22422242
}

0 commit comments

Comments
 (0)