Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for cache, convert it to es6 class #427

Merged
merged 6 commits into from
Jan 29, 2019
Merged

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jan 28, 2019

s1na added 6 commits January 28, 2019 15:59
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>
@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 91.018% when pulling 1482946 on test/fix-cache into 0d965b1 on master.

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to have this documented now, everything fine, will merge.

constructor (trie) {
this._cache = Tree()
this._checkpoints = []
this._trie = trie
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, equivalent.

let account = this.lookup(key)
if (!account) {
account = new Account()
}
return account
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put and get equivalent, ok, like this explicit addition of the default false value for fromTrie.

const account = new Account(it.value.val)
return account
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

if (err) return cb(err)
self._update(key, account, false, false)
var account = new Account(raw)
cb(null, account)
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

cb(null, account)
})
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With addition of nextTick, ok.

it.value.val = (new Account()).serialize()
self._trie.del(Buffer.from(it.key, 'hex'), function () {
}, cb)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

async.nextTick(done)
}
}, cb)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a `nextTick' addition, ok.

modified: modified,
deleted: deleted
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything ok, looked for change equivalency and completeness.


st.end()
})
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice test addition, great!

@@ -242,7 +242,6 @@ function runTests (name, runnerArgs, cb) {

function runAll () {
require('./tester.js')
require('./cacheTest.js')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, think it's safe to remove.

@holgerd77 holgerd77 merged commit 8d6ec92 into master Jan 29, 2019
@holgerd77 holgerd77 deleted the test/fix-cache branch January 29, 2019 09:00
@holgerd77
Copy link
Member

Just for info: have set test_blockchain, test_state_constantinople and coverage to being required again. These were activated for some time, can't remember the exact circumstances but it were some practical development reasons.

For coveralls I have increased the failure threshold from 80% to 90%, at the same time I made the relative threshold for failure a bit larger, from 0.5% decrease to 0.8% since from the latest experiences on refactoring work this is sometime a bit hard to achieve on larger structural changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants