Skip to content

Commit

Permalink
GODRIVER-106 remove git submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
saghm committed Oct 13, 2017
1 parent e02f98d commit 57e6a38
Show file tree
Hide file tree
Showing 352 changed files with 23,666 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BSON_PKGS = $(shell ./find_pkgs.sh ./bson)
BSON_TEST_PKGS = $(shell ./find_pkgs.sh ./bson _test)
YAMGO_PKGS = $(shell ./find_pkgs.sh ./yamgo)
YAMGO_TEST_PKGS = $(shell ./find_pkgs.sh ./yamgo _test)
BSON_PKGS = $(shell ./etc/find_pkgs.sh ./bson)
BSON_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./bson _test)
YAMGO_PKGS = $(shell ./etc/find_pkgs.sh ./yamgo)
YAMGO_TEST_PKGS = $(shell ./etc/find_pkgs.sh ./yamgo _test)
PKGS = $(BSON_PKGS) $(YAMGO_PKGS)
TEST_PKGS = $(BSON_TEST_PKGS) $(YAMGO_TEST_PKGS)

Expand Down Expand Up @@ -32,11 +32,11 @@ generate:

.PHONY: lint
lint:
golint $(PKGS) | ./lintscreen.pl .lint-whitelist
golint $(PKGS) | ./etc/lintscreen.pl .lint-whitelist

.PHONY: lint-add-whitelist
lint-add-whitelist:
golint $(PKGS) | ./lintscreen.pl -u .lint-whitelist
golint $(PKGS) | ./etc/lintscreen.pl -u .lint-whitelist

.PHONY: test
test:
Expand All @@ -54,6 +54,26 @@ test-race:
test-short:
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -short $(TEST_PKGS)

.PHONY: update-bson-corpus-tests
update-bson-corpus-tests:
etc/update-spec-tests.sh bson-corpus

.PHONY: update-connection-string-tests
update-connection-string-tests:
etc/update-spec-tests.sh connection-string

.PHONY: update-max-staleness-tests
update-max-staleness-tests:
etc/update-spec-tests.sh max-staleness

.PHONY: update-server-discovery-and-monitoring-tests
update-server-discovery-and-monitoring-tests:
etc/update-spec-tests.sh server-discovery-and-monitoring

.PHONY: update-server-selection-tests
update-server-selection-tests:
etc/update-spec-tests.sh server-selection

.PHONY: vet
vet:
go tool vet -composites=false -structtags=false -unusedstringmethods="Error" $(PKGS)
Expand Down
2 changes: 1 addition & 1 deletion bson/bson_corpus_spec_test_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const name = "bson_corpus_spec_test_generator"

func (g *Generator) generate() []byte {

testFiles, err := filepath.Glob("../../specifications/source/bson-corpus/tests/*.json")
testFiles, err := filepath.Glob("../../data/bson-corpus/*.json")
if err != nil {
log.Fatalf("error reading bson-corpus files: %s", err)
}
Expand Down
43 changes: 43 additions & 0 deletions data/bson-corpus/array.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"description": "Array",
"bson_type": "0x04",
"test_key": "a",
"valid": [
{
"description": "Empty",
"canonical_bson": "0D000000046100050000000000",
"canonical_extjson": "{\"a\" : []}"
},
{
"description": "Single Element Array",
"canonical_bson": "140000000461000C0000001030000A0000000000",
"canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}"
},
{
"description": "Single Element Array with index set incorrectly",
"degenerate_bson": "130000000461000B00000010000A0000000000",
"canonical_bson": "140000000461000C0000001030000A0000000000",
"canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}"
},
{
"description": "Single Element Array with index set incorrectly",
"degenerate_bson": "150000000461000D000000106162000A0000000000",
"canonical_bson": "140000000461000C0000001030000A0000000000",
"canonical_extjson": "{\"a\" : [{\"$numberInt\": \"10\"}]}"
}
],
"decodeErrors": [
{
"description": "Array length too long: eats outer terminator",
"bson": "140000000461000D0000001030000A0000000000"
},
{
"description": "Array length too short: leaks terminator",
"bson": "140000000461000B0000001030000A0000000000"
},
{
"description": "Invalid Array: bad string length in field",
"bson": "1A00000004666F6F00100000000230000500000062617A000000"
}
]
}
85 changes: 85 additions & 0 deletions data/bson-corpus/binary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"description": "Binary type",
"bson_type": "0x05",
"test_key": "x",
"valid": [
{
"description": "subtype 0x00 (Zero-length)",
"canonical_bson": "0D000000057800000000000000",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}"
},
{
"description": "subtype 0x00 (Zero-length, keys reversed)",
"canonical_bson": "0D000000057800000000000000",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"\", \"subType\" : \"00\"}}}",
"degenerate_extjson": "{\"x\" : { \"$binary\" : {\"subType\" : \"00\", \"base64\" : \"\"}}}"
},
{
"description": "subtype 0x00",
"canonical_bson": "0F0000000578000200000000FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"00\"}}}"
},
{
"description": "subtype 0x01",
"canonical_bson": "0F0000000578000200000001FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"01\"}}}"
},
{
"description": "subtype 0x02",
"canonical_bson": "13000000057800060000000202000000FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"02\"}}}"
},
{
"description": "subtype 0x03",
"canonical_bson": "1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"03\"}}}"
},
{
"description": "subtype 0x04",
"canonical_bson": "1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"04\"}}}"
},
{
"description": "subtype 0x05",
"canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"05\"}}}"
},
{
"description": "subtype 0x80",
"canonical_bson": "0F0000000578000200000080FFFF00",
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"//8=\", \"subType\" : \"80\"}}}"
},
{
"description": "$type query operator (conflicts with legacy $binary form with $type field)",
"canonical_bson": "1F000000037800170000000224747970650007000000737472696E67000000",
"canonical_extjson": "{\"x\" : { \"$type\" : \"string\"}}"
},
{
"description": "$type query operator (conflicts with legacy $binary form with $type field)",
"canonical_bson": "180000000378001000000010247479706500020000000000",
"canonical_extjson": "{\"x\" : { \"$type\" : {\"$numberInt\": \"2\"}}}"
}
],
"decodeErrors": [
{
"description": "Length longer than document",
"bson": "1D000000057800FF0000000573FFD26444B34C6990E8E7D1DFC035D400"
},
{
"description": "Negative length",
"bson": "0D000000057800FFFFFFFF0000"
},
{
"description": "subtype 0x02 length too long ",
"bson": "13000000057800060000000203000000FFFF00"
},
{
"description": "subtype 0x02 length too short",
"bson": "13000000057800060000000201000000FFFF00"
},
{
"description": "subtype 0x02 length negative one",
"bson": "130000000578000600000002FFFFFFFFFFFF00"
}
]
}
27 changes: 27 additions & 0 deletions data/bson-corpus/boolean.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "Boolean",
"bson_type": "0x08",
"test_key": "b",
"valid": [
{
"description": "True",
"canonical_bson": "090000000862000100",
"canonical_extjson": "{\"b\" : true}"
},
{
"description": "False",
"canonical_bson": "090000000862000000",
"canonical_extjson": "{\"b\" : false}"
}
],
"decodeErrors": [
{
"description": "Invalid boolean value of 2",
"bson": "090000000862000200"
},
{
"description": "Invalid boolean value of -1",
"bson": "09000000086200FF00"
}
]
}
Loading

0 comments on commit 57e6a38

Please sign in to comment.