node-os-utils
Version:
Advanced cross-platform operating system monitoring utilities with TypeScript support
139 lines • 3.77 kB
TypeScript
/**
* 平台特定的测试工具和配置
* 为不同操作系统提供专门的测试支持
*/
/**
* Linux特定的测试工具
*/
export declare class LinuxTestUtils {
/**
* Linux特定的系统文件路径
*/
static readonly PROC_MEMINFO = "/proc/meminfo";
static readonly PROC_CPUINFO = "/proc/cpuinfo";
static readonly PROC_STAT = "/proc/stat";
static readonly PROC_LOADAVG = "/proc/loadavg";
/**
* 检查是否可以访问/proc文件系统
*/
static canAccessProc(): boolean;
/**
* 验证Linux的负载平均值
*/
static validateLoadAverage(loads: number[]): boolean;
/**
* 获取预期的Linux命令列表
*/
static getExpectedCommands(): string[];
/**
* 验证Linux内存信息的结构
*/
static validateMemoryInfo(info: any): boolean;
}
/**
* macOS特定的测试工具
*/
export declare class MacOSTestUtils {
/**
* macOS特定的系统命令
*/
static readonly VM_STAT_CMD = "vm_stat";
static readonly TOP_CMD = "top";
static readonly DF_CMD = "df";
static readonly NETSTAT_CMD = "netstat";
/**
* 验证macOS的vm_stat输出格式
*/
static validateVmStatOutput(output: string): boolean;
/**
* 验证macOS的负载平均值(应该正常工作)
*/
static validateLoadAverage(loads: number[]): boolean;
/**
* 获取预期的macOS系统命令列表
*/
static getExpectedCommands(): string[];
/**
* 验证macOS磁盘信息格式
*/
static validateDiskInfo(info: any): boolean;
}
/**
* Windows特定的测试工具
*/
export declare class WindowsTestUtils {
/**
* Windows特定的系统命令
*/
static readonly WMIC_CMD = "wmic";
static readonly TASKLIST_CMD = "tasklist";
static readonly SYSTEMINFO_CMD = "systeminfo";
/**
* Windows上某些功能可能不支持
*/
static readonly UNSUPPORTED_FEATURES: string[];
/**
* 验证Windows的负载平均值(通常返回[0,0,0]或不支持)
*/
static validateLoadAverage(loads: number[]): boolean;
/**
* 检查功能是否在Windows上不被支持
*/
static isFeatureUnsupported(feature: string): boolean;
/**
* 获取预期的Windows系统命令列表
*/
static getExpectedCommands(): string[];
/**
* 验证Windows内存信息的结构
*/
static validateMemoryInfo(info: any): boolean;
/**
* 验证Windows磁盘信息(可能使用不同的单位)
*/
static validateDiskInfo(info: any): boolean;
}
/**
* 跨平台功能验证工具
*/
export declare class CrossPlatformValidator {
/**
* 根据当前平台选择合适的验证器
*/
static validateSystemInfo(info: any): boolean;
/**
* 验证负载平均值(考虑平台差异)
*/
static validateLoadAverage(loads: number[]): boolean;
/**
* 获取当前平台的预期命令列表
*/
static getExpectedCommands(): string[];
/**
* 检查功能是否在当前平台上被支持
*/
static isFeatureSupported(feature: string): boolean;
}
/**
* 平台特定的测试数据生成器
*/
export declare class PlatformTestDataGenerator {
/**
* 生成平台特定的测试用例
*/
static generatePlatformTestCases(): {
platform: string;
platformName: string;
expectedCommands: string[];
supportedFeatures: {
loadavg: boolean;
uptime: boolean;
};
testConfig: {
memoryTestTimeout: number;
diskTestTimeout: number;
networkTestTimeout: number;
};
};
}
//# sourceMappingURL=platform-specific.d.ts.map