-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
Improve CI setup for per version tests #1267
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9d1c984
Improve CI setup: move lint out of per version
rom1504 bfcd486
fix
rom1504 fcc6e41
Simplify go back to all per version.
rom1504 6f45a0f
refactor cycle test to use supported versions
rom1504 6ea193b
fix cycle packet test
rom1504 5b55f6c
Add v to version to avoid 1.19 running every 1.19 minor.
rom1504 0336e30
Add quotes.
rom1504 a8e12d5
Use versions from js file in ci.yml
rom1504 f2ff2c2
Fix ci.yml syntax.
rom1504 79953f6
Fix matrix read.
rom1504 62f79b9
fix
rom1504 3fa2afb
fix
rom1504 29bed0c
Merge branch 'master' into improve_ci_setup
rom1504 8c4d493
fix gitignore
rom1504 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* eslint-env mocha */ | ||
// Tests packet serialization/deserialization from with raw binary from minecraft-packets | ||
const { createSerializer, createDeserializer, states, supportedVersions } = require('minecraft-protocol') | ||
const mcPackets = require('minecraft-packets') | ||
const assert = require('assert') | ||
|
||
const makeClientSerializer = version => createSerializer({ state: states.PLAY, version, isServer: true }) | ||
const makeClientDeserializer = version => createDeserializer({ state: states.PLAY, version }) | ||
|
||
for (const supportedVersion of supportedVersions) { | ||
let serializer, deserializer, data | ||
const mcData = require('minecraft-data')(supportedVersion) | ||
const version = mcData.version | ||
|
||
function convertBufferToObject (buffer) { | ||
return deserializer.parsePacketBuffer(buffer) | ||
} | ||
|
||
function convertObjectToBuffer (object) { | ||
return serializer.createPacketBuffer(object) | ||
} | ||
|
||
function testBuffer (buffer, [packetName, packetIx]) { | ||
const parsed = convertBufferToObject(buffer).data | ||
const parsedBuffer = convertObjectToBuffer(parsed) | ||
const areEq = buffer.equals(parsedBuffer) | ||
assert.strictEqual(areEq, true, `Error when testing ${+packetIx + 1} ${packetName} packet`) | ||
} | ||
describe(`Test cycle packet for version ${supportedVersion}v`, () => { | ||
before(() => { | ||
serializer = makeClientSerializer(version.minecraftVersion) | ||
deserializer = makeClientDeserializer(version.minecraftVersion) | ||
}) | ||
data = mcPackets.pc[version.minecraftVersion] | ||
it('Has packet data', () => { | ||
if (data === undefined) { | ||
// many version do not have data, so print a log for now | ||
// assert when most versions have packet data | ||
console.log(`Version ${version.minecraftVersion} has no packet dump.`) | ||
} | ||
}) | ||
// server -> client | ||
if (data !== undefined) { | ||
Object.entries(data['from-server']).forEach(([packetName, packetData]) => { | ||
it(`${packetName} packet`, () => { | ||
for (const i in packetData) { | ||
testBuffer(packetData[i].raw, [packetName, i]) | ||
} | ||
}) | ||
}) | ||
} | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint isn't running on test/serverTest since the .gitignore has
test/server*
instead oftest/server_*
in it https://github.com/PrismarineJS/node-minecraft-protocol/blob/improve_ci_setup/.gitignore#L3There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch thanks