Skip to content

Commit

Permalink
Updated package lock and cleaned TPv2-e2e file (#8012)
Browse files Browse the repository at this point in the history
* Updated package-lock and remove =d nightwatch from tpv2-e2e/run.sh

* Updated build/package-lock

* Updated tpv2 dev dockerfile

* Fix tslint errors in cypress.config.ts

* Use TPv2 host for TO URL

* Updated cypress config

---------

Co-authored-by: Zach Hoffman <[email protected]>
  • Loading branch information
rimashah25 and zrhoffman authored May 22, 2024
1 parent 8890fd3 commit a00bc72
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dev/tpv2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN openssl genrsa -passout pass:x -out server.pass.key 2048 && \
openssl rand 32 | base64 > /aes.key && \
chmod 644 /server.key /aes.key

FROM node:16-alpine AS tpv2-dev
FROM node:20-alpine AS tpv2-dev

ENV TC="/go/src/github.com/apache/trafficcontrol"
VOLUME $TC
Expand Down
2 changes: 1 addition & 1 deletion experimental/traffic-portal/build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions experimental/traffic-portal/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import { promises as fs } from "fs";
import * as https from "https";

import axios, { type AxiosError } from "axios";
import axios, { AxiosError } from "axios";
import { defineConfig } from "cypress";
import type {
CDN,
Expand Down Expand Up @@ -49,6 +49,8 @@ import type {

import type { CreatedData } from "./cypress/support/testing.data";

import PluginEvents = Cypress.PluginEvents;

/**
* Creates mock data needed for E2E testing.
*
Expand Down Expand Up @@ -363,7 +365,7 @@ async function createData(toURL: string, apiVersion: string, adminUser: string,
data.role = resp.data.response;
} catch (e) {
const ae = e as AxiosError;
ae.message = `Request (${ae.config.method}) failed to ${url}`;
ae.message = `Request (${ae.config?.method}) failed to ${url}`;
ae.message += ae.response ? ` with response code ${ae.response.status}` : " with no response";
throw ae;
}
Expand All @@ -389,7 +391,7 @@ export default defineConfig({
},
e2e: {
baseUrl: "http://localhost:4200",
setupNodeEvents(on) {
setupNodeEvents(on: PluginEvents) {
on("before:run", async () => {
const toConfig: TOConfig = JSON.parse(await fs.readFile("cypress/fixtures/to.config.json", {encoding: "utf-8"}));
const data = await createData(toConfig.toURL, toConfig.apiVersion, toConfig.adminUser, toConfig.adminPass);
Expand Down
8 changes: 4 additions & 4 deletions experimental/traffic-portal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ TMOUT

cd /lang/traffic-portal

jq --arg TPURL $TP_URL --arg TOURL https://$TO_FQDN:$TO_PORT '.tp_url = $TPURL | .to_url = $TOURL | .disableColors = true | .retryAssertionTimeoutMS = 10000 | .waitForConditionTimeoutMS = 10000' \
nightwatch/config.json > config.tmp.json && mv config.tmp.json nightwatch/config.json
config=cypress/fixtures/to.config.json
echo "$(<"$config" jq --arg TPURL $TP_URL --arg TOURL https://$TO_FQDN:$TO_PORT '.toURL = $TPURL')" > "$config"
sync

npm run e2e:ci
rc=$?
Expand Down

0 comments on commit a00bc72

Please sign in to comment.