Skip to content

Commit

Permalink
fix: reuse endpoint and rename test util function to fit in purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
lizable committed Sep 9, 2024
1 parent 8019594 commit 3c0509d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
43 changes: 4 additions & 39 deletions e2e/config-test.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,11 @@
[general]
# apiEndpoint = "http://localhost:8090"
# apiEndpoint = "http://127.0.0.1:8090"
# apiEndpoint = "http://10.100.11.1:8090"
# apiEndpoint = "https://dogbowl.cloud.backend.ai"
# apiEndpoint = "http://10.82.230.101:8090"
# apiEndpoint = "http://10.100.64.15:8090"
# apiEndpoint ="https://aitrain.ktcloud.com"


# apiEndpoint = "http://10.82.230.94:8090"
# apiEndpoint = "http://10.82.230.101:8090"
# apiEndpoint = "https://cloud.backend.ai"
#apiEndpoint = "http://10.82.230.115:8090"
# apiEndpoint = "http://10.172.160.61:8080"
# apiEndpoint = "http://10.82.230.230:8090"
# apiEndpoint = "https://www.nipa2023.ktcloud.com:8000"
# apiEndpoint = "https://cloud.backend.ai"
# apiEndpoint = "http://0.0.0.0:8090"
# apiEndpoint = "http://10.100.64.13:8090"
# apiEndpoint = "http://10.20.30.10:9004"
apiEndpoint = "http://127.0.0.1:8090"
apiEndpointText = "Backend.AI Admin Training"
# defaultSessionEnvironment = "cr.backend.ai/testing/mojo:2309"
# defaultSessionEnvironment = "cr.backend.ai/stable/python"

defaultSessionEnvironment = "cr.backend.ai/stable/python-tensorflow"

# defaultSessionEnvironment = "cr.backend.ai/community/spectravis:19.10"
maxCountForPreOpenedPort = 1
# defaultSessionEnvironment = "cr.backend.ai/stable/python:3.8-ubuntu20.04-arm64"

#defaultSessionEnvironment = "[Default session kernel. If blank, alphabetically first kernel will be default.]"
# defaultImportEnvironment = "cr.backend.ai/stable/python:3.8-ubuntu20.04-arm64"
# defaultImportEnvironment = "cr.backend.ai/multiarch/python:3.9-ubuntu20.04-aarch64"
# defaultImportEnvironment = "cr.backend.ai/multiarch/python:3.9-ubuntu20.04"
# defaultImportEnvironment = "cr.backend.ai/stable/python"
siteDescription = "NIPA NPU Farm"
# siteDescription = ""
connectionMode = "SESSION" #connectionMode = API
allowChangeSigninMode = true
signupSupport = true
Expand All @@ -56,9 +28,7 @@ alwaysEnqueueComputeSession = true
showCustomResourceAllocation = true
enable2FA = true
force2FA = false
# systemSSHImage = "cr.backend.ai/testing/filebrowser:23.04-ubuntu20.04-arm64"
# systemSSHImage = "cr.backend.ai/testing/filebrowser:23.10-amd64"
# cr.backend.ai/testing/filebrowser:23.04-ubuntu20.04
systemSSHImage = "cr.backend.ai/stable/python-tensorflow"
isDirectorySizeVisible = false
allowCustomResourceAllocation = true
forceTerminateTimeThreshold = 259200
Expand All @@ -67,12 +37,7 @@ enableExtendLoginSession = false
showNonInstalledImages = false

[wsproxy]
# proxyURL = "http://10.100.64.15:10200/"
proxyURL = "http://127.0.0.1:5050/"
# proxyURL = "http://10.20.30.10:10202"
# proxyURL = "http://10.100.64.13:10202"
#proxyURL = "https://wsproxy.onprem.backend.ai:9443/"
#proxyBaseURL = ""
autoPortSelection = true
disableCertCheck = true

Expand Down
6 changes: 3 additions & 3 deletions e2e/config.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { loginAsAdmin, readConfigFileFromPath } from './test-util';
import { loginAsAdmin, mockConfigToml, webuiEndpoint } from './test-util';
import { test, expect } from '@playwright/test';

test.describe('config read and test', () => {
test('should read config file from the path', async ({ page, context }) => {
// manipulate config file from mocked one
await readConfigFileFromPath(page, './config-test.toml');
await mockConfigToml(page, './config-test.toml');

await loginAsAdmin(page);

Expand Down Expand Up @@ -43,7 +43,7 @@ test.describe('config read and test', () => {

const uninstalledImageString = `${registry}/${namespace}/${language}:${version}@${architecture}`;

await page.goto('http://127.0.0.1:9081/summary');
await page.goto(webuiEndpoint);
await page.getByLabel('power_settings_new').click();
await page
.getByRole('button', { name: '2 Environments & Resource' })
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export async function deleteSession(page: Page, sessionName: string) {
await expect(page.getByText(sessionName)).toBeHidden();
}

export async function readConfigFileFromPath(page: Page, rawPath) {
export async function mockConfigToml(page: Page, rawPath) {
const filePath = path.resolve(__dirname, rawPath);
const mockData = await fs.readFile(filePath, 'utf-8');
await page.route('http://127.0.0.1:9081/config.toml', async (route) => {
Expand Down
4 changes: 2 additions & 2 deletions react/src/components/ImageEnvironmentSelectFormItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const ImageEnvironmentSelectFormItems: React.FC<

const envSelectRef = useRef<RefSelectProps>(null);
const versionSelectRef = useRef<RefSelectProps>(null);
const ImageEnvironmentSelectFormItemsVariables = baiClient?._config
const imageEnvironmentSelectFormItemsVariables = baiClient?._config
?.showNonInstalledImages
? {}
: { installed: true };
Expand All @@ -120,7 +120,7 @@ const ImageEnvironmentSelectFormItems: React.FC<
}
}
`,
ImageEnvironmentSelectFormItemsVariables,
imageEnvironmentSelectFormItemsVariables,
{
fetchPolicy: 'store-and-network',
},
Expand Down

0 comments on commit 3c0509d

Please sign in to comment.