CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-flink--flink-test-utils-parent

Comprehensive testing utilities for Apache Flink stream processing framework

Pending
Overview
Eval results
Files

migration-testing.mddocs/

Migration and Compatibility Testing

Utilities for testing state migration between Flink versions and ensuring compatibility across version upgrades. These tools enable comprehensive testing of application state evolution and backward compatibility.

Capabilities

Migration Test Framework

MigrationTest Interface

Marker interface for identifying migration-related tests.

/**
 * Marker interface for migration tests
 * Used to categorize tests that verify version compatibility
 */
interface MigrationTest {
    // Marker interface - no methods
}

Usage Examples:

import org.apache.flink.test.util.MigrationTest;

public class MyStateMigrationTest implements MigrationTest {
    @Test
    public void testStateCompatibilityAcrossVersions() {
        // Migration test implementation
    }
}

Snapshot Generation

MigrationTestsSnapshotGenerator

Utility for generating test snapshots that can be used for migration testing across Flink versions.

/**
 * Generate snapshots for migration testing
 * Creates savepoints and checkpoints for compatibility testing
 */
class MigrationTestsSnapshotGenerator {
    /** Generate snapshot for current version */
    static void generateSnapshot(String snapshotPath, StreamExecutionEnvironment env) throws Exception;
    
    /** Generate snapshot with specific configuration */
    static void generateSnapshot(String snapshotPath, StreamExecutionEnvironment env, 
                               Configuration config) throws Exception;
    
    /** Validate snapshot format */
    static boolean validateSnapshotFormat(String snapshotPath);
    
    /** Get snapshot metadata */
    static SnapshotMetadata getSnapshotMetadata(String snapshotPath);
}

/**
 * Metadata about generated snapshots
 */
class SnapshotMetadata {
    /** Get Flink version that created the snapshot */
    String getFlinkVersion();
    
    /** Get checkpoint/savepoint timestamp */
    long getTimestamp();
    
    /** Get state backend information */
    String getStateBackend();
    
    /** Get operator state information */
    Map<String, OperatorState> getOperatorStates();
}

Usage Examples:

import org.apache.flink.test.migration.MigrationTestsSnapshotGenerator;

// Generate snapshot for current version
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// ... configure job with stateful operators
MigrationTestsSnapshotGenerator.generateSnapshot("/path/to/snapshot", env);

// Validate existing snapshot
boolean isValid = MigrationTestsSnapshotGenerator.validateSnapshotFormat("/path/to/old/snapshot");
assertTrue(isValid);

// Get snapshot information
SnapshotMetadata metadata = MigrationTestsSnapshotGenerator.getSnapshotMetadata("/path/to/snapshot");
System.out.println("Created by Flink version: " + metadata.getFlinkVersion());

Version Utilities

PublishedVersionUtils

Utilities for working with published Flink versions in migration tests.

/**
 * Utilities for working with published Flink versions
 * Helps manage version compatibility testing
 */
class PublishedVersionUtils {
    /** Get list of all published Flink versions */
    static List<String> getAllPublishedVersions();
    
    /** Get versions compatible with current version */
    static List<String> getCompatibleVersions();
    
    /** Check if version supports specific feature */
    static boolean supportsFeature(String version, String feature);
    
    /** Get version comparison result */
    static int compareVersions(String version1, String version2);
    
    /** Parse version string into components */
    static FlinkVersion parseVersion(String versionString);
}

/**
 * Structured representation of Flink version
 */
class FlinkVersion implements Comparable<FlinkVersion> {
    /** Get major version number */
    int getMajor();
    
    /** Get minor version number */
    int getMinor();
    
    /** Get patch version number */
    int getPatch();
    
    /** Get version string representation */
    String toString();
    
    /** Check if this version is newer than other */
    boolean isNewerThan(FlinkVersion other);
    
    int compareTo(FlinkVersion other);
}

Snapshot Utilities

SnapshotGeneratorUtils

Low-level utilities for snapshot generation and manipulation.

/**
 * Utilities for snapshot generation and manipulation
 * Provides fine-grained control over snapshot creation
 */
class SnapshotGeneratorUtils {
    /** Create savepoint from running job */
    static String createSavepoint(JobID jobId, String savepointPath, ClusterClient<?> client) 
        throws Exception;
    
    /** Restore job from savepoint */
    static JobID restoreFromSavepoint(JobGraph jobGraph, String savepointPath, 
                                    ClusterClient<?> client) throws Exception;
    
    /** Convert checkpoint to savepoint */
    static void convertCheckpointToSavepoint(String checkpointPath, String savepointPath) 
        throws Exception;
    
    /** Validate savepoint compatibility */
    static boolean isCompatible(String savepointPath, JobGraph jobGraph);
    
    /** Extract operator state from snapshot */
    static Map<String, byte[]> extractOperatorState(String snapshotPath, String operatorId) 
        throws Exception;
    
    /** Create synthetic snapshot for testing */
    static void createSyntheticSnapshot(String snapshotPath, Map<String, Object> stateData) 
        throws Exception;
}

Install with Tessl CLI

npx tessl i tessl/maven-org-apache-flink--flink-test-utils-parent

docs

client-testing.md

connector-testing.md

core-testing.md

index.md

migration-testing.md

table-testing.md

test-environments.md

tile.json