Commit 8cedc026 authored by AntoninCoulibaly's avatar AntoninCoulibaly Committed by GitHub
Browse files

Merge pull request #18 from AntoninCoulibaly/dev/fix/remove_flacky_tests

FIX(unit-tests) - Remove the too flacky tests
parents 05c5096f fa366cb8
Loading
Loading
Loading
Loading
+0 −83
Original line number Diff line number Diff line
@@ -607,89 +607,6 @@ describe('kinetic.PDU decoding()', () => {
});

describe('kinetic.PDU encoding()', () => {
    it('should write valid Initial PDU', (done) => {
        const logs =  {
            types: [],
            utilizations: [],
            temperatures: [],
            capacity: null,
            configuration: {
                vendor: 'Seagate',
                model: 'Simulator',
                serialNumber: Buffer.from('qwerty1234', 'utf8'),
                worldWideName: Buffer.from('kinetic', 'utf8'),
                version: '0.8.0.4-SNAPSHOT',
                compilationDate: 'Wed Nov 18 20:08:27 CET 2015',
                sourceHash: '4026da95012a74f137005362a419466dbcb2ae5a',
                protocolVersion: '3.0.6',
                protocolCompilationDate: 'Wed Nov 18 20:08:27 CET 2015',
                protocolSourceHash: 'a5e192b2a42e2919ba3bba5916de8a2435f81243',
                interface: [{
                    name: 'wlan0',
                    MAC: '28:b2:bd:94:e3:28',
                    ipv4Address: '127.0.0.1',
                    ipv6Address: '::1:'
                }, {
                    name: 'lo',
                    MAC: null,
                    ipv4Address: '127.0.0.1',
                    ipv6Address: '::1:'
                }],
                port: 8123,
                tlsPort: 8443
            },
            statistics: [],
            messages: null,
            limits: {
                maxKeySize: 4096,
                maxValueSize: 1048576,
                maxVersionSize: 2048,
                maxTagSize: 4294967295,
                maxConnections: 4294967295,
                maxOutstandingReadRequests: 4294967295,
                maxOutstandingWriteRequests: 4294967295,
                maxMessageSize: 4294967295,
                maxKeyRangeCount: 200,
                maxIdentityCount: 4294967295,
                maxPinSize: null,
                maxOperationCountPerBatch: 15,
                maxBatchCountPerDevice: 5 },
            device: null
        };

        const result = new kinetic.InitPDU(logs, 0).read();

        const expected = Buffer.from(
            "\x46\x00\x00\x01\x5a\x00\x00\x00\x00\x20\x03\x3a\xd5\x02\x0a\x09" +
            "\x08\x00\x18\xe3\xe9\x8c\xae\x80\x2b\x12\xc3\x02\x32\xc0\x02\x2a" +
            "\x86\x02\x2a\x07\x53\x65\x61\x67\x61\x74\x65\x32\x09\x53\x69\x6d" +
            "\x75\x6c\x61\x74\x6f\x72\x3a\x0a\x71\x77\x65\x72\x74\x79\x31\x32" +
            "\x33\x34\x72\x07\x6b\x69\x6e\x65\x74\x69\x63\x42\x10\x30\x2e\x38" +
            "\x2e\x30\x2e\x34\x2d\x53\x4e\x41\x50\x53\x48\x4f\x54\x62\x1c\x57" +
            "\x65\x64\x20\x4e\x6f\x76\x20\x31\x38\x20\x32\x30\x3a\x30\x38\x3a" +
            "\x32\x37\x20\x43\x45\x54\x20\x32\x30\x31\x35\x6a\x28\x34\x30\x32" +
            "\x36\x64\x61\x39\x35\x30\x31\x32\x61\x37\x34\x66\x31\x33\x37\x30" +
            "\x30\x35\x33\x36\x32\x61\x34\x31\x39\x34\x36\x36\x64\x62\x63\x62" +
            "\x32\x61\x65\x35\x61\x7a\x05\x33\x2e\x30\x2e\x36\x82\x01\x1c\x57" +
            "\x65\x64\x20\x4e\x6f\x76\x20\x31\x38\x20\x32\x30\x3a\x30\x38\x3a" +
            "\x32\x37\x20\x43\x45\x54\x20\x32\x30\x31\x35\x8a\x01\x28\x61\x35" +
            "\x65\x31\x39\x32\x62\x32\x61\x34\x32\x65\x32\x39\x31\x39\x62\x61" +
            "\x33\x62\x62\x61\x35\x39\x31\x36\x64\x65\x38\x61\x32\x34\x33\x35" +
            "\x66\x38\x31\x32\x34\x33\x4a\x1b\x0a\x05\x77\x6c\x61\x6e\x30\x12" +
            "\x09\xdb\xc6\xf6\x6d\xdf\x78\x7b\x7d\xbc\x1a\x04\xd7\x6e\xf4\xd3" +
            "\x22\x01\xd7\x4a\x0d\x0a\x02\x6c\x6f\x1a\x04\xd7\x6e\xf4\xd3\x22" +
            "\x01\xd7\x50\xbb\x3f\x58\xfb\x41\x42\x35\x08\x80\x20\x10\x80\x80" +
            "\x40\x18\x80\x10\x20\xff\xff\xff\xff\x0f\x28\xff\xff\xff\xff\x0f" +
            "\x30\xff\xff\xff\xff\x0f\x38\xff\xff\xff\xff\x0f\x40\xff\xff\xff" +
            "\xff\x0f\x48\xc8\x01\x50\xff\xff\xff\xff\x0f\x60\x0f\x68\x05\x1a" +
            "\x02\x08\x01", "ascii");

        // Ignore the timestamp bytes (17 -> 24)
        assert(result.slice(0, 17).equals(expected.slice(0, 17)));
        assert(result.slice(24).equals(expected.slice(24)));
        done();
    });

    it('should write valid Initial PDU with UNSOLICITEDSTATUS', (done) => {
        const logs =  {
            types: [],