Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
/**
|
|
* Test script to publish a message directly to Redis stream
|
|
*/
|
|
import { createClient } from 'redis';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
import dotenv from 'dotenv';
|
|
import { getSecretProviderInstance } from '../../shared/core/secretProvider';
|
|
|
|
// Load environment variables
|
|
dotenv.config();
|
|
|
|
async function publishTestEvent() {
|
|
try {
|
|
console.log('Connecting to Redis...');
|
|
|
|
// Get Redis password from secret provider with fallback to environment variable
|
|
const secretProvider = await getSecretProviderInstance();
|
|
const redisPassword = await secretProvider.getAppSecret('REDIS_PASSWORD') || process.env.REDIS_PASSWORD;
|
|
|
|
// Create Redis client
|
|
const client = createClient({
|
|
url: `redis://${process.env.REDIS_HOST || 'localhost'}:${process.env.REDIS_PORT || '6379'}`,
|
|
password: redisPassword
|
|
});
|
|
|
|
// Handle connection errors
|
|
client.on('error', (err) => {
|
|
console.error('Redis Client Error:', err);
|
|
});
|
|
|
|
// Connect to Redis
|
|
await client.connect();
|
|
console.log('Connected to Redis');
|
|
|
|
// Create a test event that matches the WorkflowEventBaseSchema
|
|
const event = {
|
|
event_id: uuidv4(),
|
|
execution_id: uuidv4(),
|
|
event_name: 'TEST_EVENT',
|
|
event_type: 'TEST_EVENT',
|
|
tenant: 'test-tenant',
|
|
timestamp: new Date().toISOString(),
|
|
payload: {
|
|
tenantId: 'test-tenant',
|
|
message: 'This is a test event',
|
|
timestamp: new Date().toISOString()
|
|
}
|
|
};
|
|
|
|
// Publish to the global workflow events stream
|
|
const streamName = 'workflow:events:global';
|
|
|
|
console.log(`Publishing test event to stream: ${streamName}`);
|
|
const messageId = await client.xAdd(
|
|
streamName,
|
|
'*', // Auto-generate ID
|
|
{ event: JSON.stringify(event) }
|
|
);
|
|
|
|
console.log(`Event published successfully with ID: ${messageId}`);
|
|
|
|
// Close Redis connection
|
|
await client.quit();
|
|
console.log('Redis connection closed');
|
|
} catch (error) {
|
|
console.error('Error publishing event:', error);
|
|
}
|
|
}
|
|
|
|
publishTestEvent(); |