re-uploading work

This commit is contained in:
2026-02-04 17:46:30 -06:00
commit 3b14c65998
1388 changed files with 381262 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
#!/usr/bin/env python3
"""
Echo Action for E2E Testing
Echoes back the input message with timestamp and execution metrics
"""
import json
import sys
import time
from datetime import datetime
def main():
"""Main entry point for the echo action"""
start_time = time.time()
try:
# Read parameters from stdin (Attune standard)
input_data = json.loads(sys.stdin.read())
# Extract parameters
message = input_data.get("message", "Hello from Attune!")
delay = input_data.get("delay", 0)
should_fail = input_data.get("fail", False)
# Validate parameters
if not isinstance(message, str):
raise ValueError(f"message must be a string, got {type(message).__name__}")
if not isinstance(delay, int) or delay < 0 or delay > 30:
raise ValueError(f"delay must be an integer between 0 and 30, got {delay}")
# Simulate delay if requested
if delay > 0:
print(f"Delaying for {delay} seconds...", file=sys.stderr)
time.sleep(delay)
# Simulate failure if requested
if should_fail:
raise RuntimeError(f"Action intentionally failed as requested (fail=true)")
# Calculate execution time
execution_time = time.time() - start_time
# Create output
output = {
"message": message,
"timestamp": datetime.utcnow().isoformat() + "Z",
"execution_time": round(execution_time, 3),
"success": True,
}
# Write output to stdout
print(json.dumps(output, indent=2))
# Log to stderr for debugging
print(
f"Echo action completed successfully in {execution_time:.3f}s",
file=sys.stderr,
)
return 0
except json.JSONDecodeError as e:
error_output = {
"success": False,
"error": "Invalid JSON input",
"details": str(e),
}
print(json.dumps(error_output), file=sys.stdout)
print(f"ERROR: Failed to parse JSON input: {e}", file=sys.stderr)
return 1
except Exception as e:
execution_time = time.time() - start_time
error_output = {
"success": False,
"error": str(e),
"execution_time": round(execution_time, 3),
}
print(json.dumps(error_output), file=sys.stdout)
print(f"ERROR: {e}", file=sys.stderr)
return 1
if __name__ == "__main__":
sys.exit(main())

View File

@@ -0,0 +1,43 @@
# Simple Echo Action for Testing
# Echoes the input message back to verify action execution
name: echo
description: "Echo a message back - simple test action"
enabled: true
runner_type: python
parameters:
message:
type: string
description: "Message to echo back"
required: true
default: "Hello from Attune!"
delay:
type: integer
description: "Delay in seconds before echoing (for testing timing)"
required: false
default: 0
minimum: 0
maximum: 30
fail:
type: boolean
description: "Force the action to fail (for testing error handling)"
required: false
default: false
entry_point: actions/echo.py
output_schema:
type: object
properties:
message:
type: string
description: "The echoed message"
timestamp:
type: string
description: "Timestamp when the message was echoed"
execution_time:
type: number
description: "Time taken to execute in seconds"

View File

@@ -0,0 +1,52 @@
# Test Pack for End-to-End Integration Testing
# This pack contains simple actions and workflows for testing the Attune platform
ref: test_pack
name: "E2E Test Pack"
label: "E2E Test Pack"
description: "Test pack for end-to-end integration testing"
version: "1.0.0"
author: "Attune Team"
email: "test@attune.example.com"
# Pack configuration schema
conf_schema:
type: object
properties:
test_mode:
type: boolean
default: true
timeout:
type: integer
default: 30
required: []
# Default pack configuration
config:
test_mode: true
timeout: 30
# Pack metadata
meta:
category: "testing"
keywords:
- "test"
- "e2e"
- "integration"
# Python dependencies for this pack
python_dependencies:
- "requests>=2.28.0"
# Pack tags for discovery
tags:
- test
- integration
- e2e
# Runtime dependencies
runtime_deps:
- python3
# Standard pack flag
is_standard: false

View File

@@ -0,0 +1,56 @@
# Simple Workflow for End-to-End Integration Testing
# Tests sequential task execution, variable passing, and workflow completion
name: simple_workflow
description: "Simple 3-task workflow for testing workflow orchestration"
version: "1.0.0"
# Input parameters for the workflow
input:
- workflow_message
- workflow_delay
# Workflow variables (initialized at start)
vars:
- start_time: null
- task_count: 3
# Workflow tasks
tasks:
# Task 1: Echo the start message
task_start:
action: test_pack.echo
input:
message: "{{ _.workflow_message or 'Starting workflow...' }}"
delay: 0
fail: false
publish:
- start_time: "{{ task_start.result.timestamp }}"
on-success:
- task_wait
# Task 2: Wait for specified delay
task_wait:
action: test_pack.echo
input:
message: "Waiting {{ _.workflow_delay or 2 }} seconds..."
delay: "{{ _.workflow_delay or 2 }}"
fail: false
on-success:
- task_complete
# Task 3: Complete the workflow
task_complete:
action: test_pack.echo
input:
message: "Workflow completed successfully! Started at {{ _.start_time }}"
delay: 0
fail: false
# Workflow output (what to return when complete)
output:
workflow_result: "{{ task_complete.result.message }}"
total_tasks: "{{ _.task_count }}"
start_time: "{{ _.start_time }}"
end_time: "{{ task_complete.result.timestamp }}"
all_tasks_succeeded: true