diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 893ae9b..28ee123 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -237,7 +237,7 @@ jobs: ./tests/e2e/${{ matrix.test }}.sh env: # Use a unique root directory for each test run - TX3_ROOT_DIR: ${{ github.workspace }}/test-root-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.test }} + TX3_ROOT: ${{ github.workspace }}/test-root-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.test }} TX3_CHANNEL: ${{ inputs.test_channel }} - name: Upload test artifacts on failure diff --git a/tests/e2e/fresh_install.sh b/tests/e2e/fresh_install.sh index 9a551cc..8969f79 100755 --- a/tests/e2e/fresh_install.sh +++ b/tests/e2e/fresh_install.sh @@ -14,11 +14,11 @@ NC='\033[0m' # No Color # Test configuration TEST_NAME="fresh_install" TEMP_DIR=$(mktemp -d) -export TX3_ROOT_DIR="$TEMP_DIR/tx3_test" +export TX3_ROOT="$TEMP_DIR/tx3_test" export TX3_CHANNEL="${TX3_CHANNEL:-stable}" echo -e "${YELLOW}Starting $TEST_NAME test...${NC}" -echo "TX3_ROOT_DIR: $TX3_ROOT_DIR" +echo "TX3_ROOT: $TX3_ROOT" echo "TX3_CHANNEL: $TX3_CHANNEL" echo "Temp directory: $TEMP_DIR" @@ -76,11 +76,11 @@ main() { echo -e "${YELLOW}Step 1: Verifying clean state${NC}" # Ensure the root directory doesn't exist initially - if [[ -e "$TX3_ROOT_DIR" ]]; then - echo -e "${RED}✗ TX3_ROOT_DIR already exists, not a fresh install${NC}" + if [[ -e "$TX3_ROOT" ]]; then + echo -e "${RED}✗ TX3_ROOT already exists, not a fresh install${NC}" exit 1 fi - echo -e "${GREEN}✓ Clean state verified - TX3_ROOT_DIR does not exist${NC}" + echo -e "${GREEN}✓ Clean state verified - TX3_ROOT does not exist${NC}" echo -e "${YELLOW}Step 2: Running tx3up install${NC}" @@ -95,25 +95,25 @@ main() { echo -e "${YELLOW}Step 3: Verifying installation artifacts${NC}" # Check if the root directory was created - check_directory "$TX3_ROOT_DIR" "TX3 root directory" + check_directory "$TX3_ROOT" "TX3 root directory" # Check if the channel directory exists - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL" "Channel directory ($TX3_CHANNEL)" + check_directory "$TX3_ROOT/$TX3_CHANNEL" "Channel directory ($TX3_CHANNEL)" # Check if the bin directory exists - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL/bin" "Binary directory" + check_directory "$TX3_ROOT/$TX3_CHANNEL/bin" "Binary directory" # Check if manifest file exists - check_file "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json" "Manifest file" + check_file "$TX3_ROOT/$TX3_CHANNEL/manifest.json" "Manifest file" echo -e "${YELLOW}Step 4: Verifying installation contents${NC}" # List the contents of the installation for debugging echo "Installation directory contents:" - find "$TX3_ROOT_DIR" -type f -exec ls -la {} \; 2>/dev/null || true + find "$TX3_ROOT" -type f -exec ls -la {} \; 2>/dev/null || true # Check if at least one binary was installed - bin_count=$(find "$TX3_ROOT_DIR/$TX3_CHANNEL/bin" -type f -executable 2>/dev/null | wc -l) + bin_count=$(find "$TX3_ROOT/$TX3_CHANNEL/bin" -type f -executable 2>/dev/null | wc -l) if [[ $bin_count -gt 0 ]]; then echo -e "${GREEN}✓ Found $bin_count executable binaries in bin directory${NC}" else @@ -125,7 +125,7 @@ main() { # Verify the manifest file is valid JSON if command -v jq >/dev/null 2>&1; then - if jq empty "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json" 2>/dev/null; then + if jq empty "$TX3_ROOT/$TX3_CHANNEL/manifest.json" 2>/dev/null; then echo -e "${GREEN}✓ Manifest file is valid JSON${NC}" else echo -e "${RED}✗ Manifest file is not valid JSON${NC}" @@ -133,7 +133,7 @@ main() { fi else # Basic JSON validation without jq - if grep -q '^\s*{' "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json" && grep -q '}\s*$' "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json"; then + if grep -q '^\s*{' "$TX3_ROOT/$TX3_CHANNEL/manifest.json" && grep -q '}\s*$' "$TX3_ROOT/$TX3_CHANNEL/manifest.json"; then echo -e "${GREEN}✓ Manifest file appears to be JSON (basic check)${NC}" else echo -e "${RED}✗ Manifest file does not appear to be valid JSON${NC}" @@ -143,11 +143,11 @@ main() { echo -e "${GREEN}🎉 Fresh install test completed successfully!${NC}" echo -e "${GREEN}All installation artifacts verified:${NC}" - echo -e "${GREEN} - Root directory: $TX3_ROOT_DIR${NC}" + echo -e "${GREEN} - Root directory: $TX3_ROOT${NC}" echo -e "${GREEN} - Channel: $TX3_CHANNEL${NC}" - echo -e "${GREEN} - Channel directory: $TX3_ROOT_DIR/$TX3_CHANNEL${NC}" - echo -e "${GREEN} - Binary directory: $TX3_ROOT_DIR/$TX3_CHANNEL/bin${NC}" - echo -e "${GREEN} - Manifest file: $TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json${NC}" + echo -e "${GREEN} - Channel directory: $TX3_ROOT/$TX3_CHANNEL${NC}" + echo -e "${GREEN} - Binary directory: $TX3_ROOT/$TX3_CHANNEL/bin${NC}" + echo -e "${GREEN} - Manifest file: $TX3_ROOT/$TX3_CHANNEL/manifest.json${NC}" echo -e "${GREEN} - Executable binaries: $bin_count${NC}" } diff --git a/tests/e2e/update_install.sh b/tests/e2e/update_install.sh index 6e83e9c..3784144 100755 --- a/tests/e2e/update_install.sh +++ b/tests/e2e/update_install.sh @@ -14,11 +14,11 @@ NC='\033[0m' # No Color # Test configuration TEST_NAME="update_install" TEMP_DIR=$(mktemp -d) -export TX3_ROOT_DIR="$TEMP_DIR/tx3_test" +export TX3_ROOT="$TEMP_DIR/tx3_test" export TX3_CHANNEL="${TX3_CHANNEL:-stable}" echo -e "${YELLOW}Starting $TEST_NAME test...${NC}" -echo "TX3_ROOT_DIR: $TX3_ROOT_DIR" +echo "TX3_ROOT: $TX3_ROOT" echo "TX3_CHANNEL: $TX3_CHANNEL" echo "Temp directory: $TEMP_DIR" @@ -96,8 +96,8 @@ main() { echo -e "${YELLOW}Step 1: Performing initial installation${NC}" # Ensure clean state - if [[ -e "$TX3_ROOT_DIR" ]]; then - rm -rf "$TX3_ROOT_DIR" + if [[ -e "$TX3_ROOT" ]]; then + rm -rf "$TX3_ROOT" fi # Run initial installation @@ -109,22 +109,22 @@ main() { echo -e "${GREEN}✓ Initial installation completed${NC}" # Verify initial installation - check_directory "$TX3_ROOT_DIR" "TX3 root directory" - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL" "Channel directory ($TX3_CHANNEL)" - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL/bin" "Binary directory" - check_file "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json" "Manifest file" + check_directory "$TX3_ROOT" "TX3 root directory" + check_directory "$TX3_ROOT/$TX3_CHANNEL" "Channel directory ($TX3_CHANNEL)" + check_directory "$TX3_ROOT/$TX3_CHANNEL/bin" "Binary directory" + check_file "$TX3_ROOT/$TX3_CHANNEL/manifest.json" "Manifest file" echo -e "${YELLOW}Step 2: Recording initial state${NC}" # Record initial state - initial_manifest_mtime=$(get_file_mtime "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json") - initial_bin_count=$(count_files "$TX3_ROOT_DIR/$TX3_CHANNEL/bin") + initial_manifest_mtime=$(get_file_mtime "$TX3_ROOT/$TX3_CHANNEL/manifest.json") + initial_bin_count=$(count_files "$TX3_ROOT/$TX3_CHANNEL/bin") echo "Initial manifest mtime: $initial_manifest_mtime" echo "Initial binary count: $initial_bin_count" # Create a test marker file to verify update behavior - test_marker="$TX3_ROOT_DIR/test_marker.txt" + test_marker="$TX3_ROOT/test_marker.txt" echo "test_marker_$(date +%s)" > "$test_marker" # Wait a moment to ensure different timestamps @@ -143,10 +143,10 @@ main() { echo -e "${YELLOW}Step 4: Verifying update behavior${NC}" # Verify installation still exists and is functional - check_directory "$TX3_ROOT_DIR" "TX3 root directory (after update)" - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL" "Channel directory (after update)" - check_directory "$TX3_ROOT_DIR/$TX3_CHANNEL/bin" "Binary directory (after update)" - check_file "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json" "Manifest file (after update)" + check_directory "$TX3_ROOT" "TX3 root directory (after update)" + check_directory "$TX3_ROOT/$TX3_CHANNEL" "Channel directory (after update)" + check_directory "$TX3_ROOT/$TX3_CHANNEL/bin" "Binary directory (after update)" + check_file "$TX3_ROOT/$TX3_CHANNEL/manifest.json" "Manifest file (after update)" # Check if our test marker still exists (should be preserved during update) if [[ -f "$test_marker" ]]; then @@ -156,8 +156,8 @@ main() { fi # Record post-update state - updated_manifest_mtime=$(get_file_mtime "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json") - updated_bin_count=$(count_files "$TX3_ROOT_DIR/$TX3_CHANNEL/bin") + updated_manifest_mtime=$(get_file_mtime "$TX3_ROOT/$TX3_CHANNEL/manifest.json") + updated_bin_count=$(count_files "$TX3_ROOT/$TX3_CHANNEL/bin") echo "Updated manifest mtime: $updated_manifest_mtime" echo "Updated binary count: $updated_bin_count" @@ -181,7 +181,7 @@ main() { fi # Verify that at least some binaries are still executable - executable_count=$(find "$TX3_ROOT_DIR/$TX3_CHANNEL/bin" -type f -executable 2>/dev/null | wc -l) + executable_count=$(find "$TX3_ROOT/$TX3_CHANNEL/bin" -type f -executable 2>/dev/null | wc -l) if [[ $executable_count -gt 0 ]]; then echo -e "${GREEN}✓ Found $executable_count executable binaries after update${NC}" else @@ -198,8 +198,8 @@ main() { fi # Verify installation is still intact - final_manifest_mtime=$(get_file_mtime "$TX3_ROOT_DIR/$TX3_CHANNEL/manifest.json") - final_bin_count=$(count_files "$TX3_ROOT_DIR/$TX3_CHANNEL/bin") + final_manifest_mtime=$(get_file_mtime "$TX3_ROOT/$TX3_CHANNEL/manifest.json") + final_bin_count=$(count_files "$TX3_ROOT/$TX3_CHANNEL/bin") if [[ $final_bin_count -eq $updated_bin_count ]]; then echo -e "${GREEN}✓ Idempotency test passed - binary count unchanged${NC}" @@ -212,7 +212,7 @@ main() { echo -e "${GREEN} - Initial binary count: $initial_bin_count${NC}" echo -e "${GREEN} - Updated binary count: $updated_bin_count${NC}" echo -e "${GREEN} - Final binary count: $final_bin_count${NC}" - echo -e "${GREEN} - Installation directory: $TX3_ROOT_DIR${NC}" + echo -e "${GREEN} - Installation directory: $TX3_ROOT${NC}" echo -e "${GREEN} - Manifest updates: $initial_manifest_mtime → $updated_manifest_mtime → $final_manifest_mtime${NC}" }