mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
This is a design to let us write test cases for ingest with schema setup and data in the json formats we want to use, and results as alternating queries and expected results, so we can just create new test files and run the tests against them. We also have to report back what we created when creating things. In the process of developing this, I noticed that the documentation describes ingest schema as allowing more than one schema operation, but we didn't support this, and also it wouldn't do much good because there was no way to do partial things like "just add a field". Fixed. Also we implement comparison for ops, so the test output is actually a test rather than just some data to visually eyeball. In the process, realize that the handling of timestamps was wrong; we said that we take them as raw numbers relative to the epoch, not as raw Unix timestamps. Also a couple of related cleanups caught by doing the testing.
101 lines
2.4 KiB
Text
101 lines
2.4 KiB
Text
schema-error: fail to create field
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "create",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "cookie",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
},
|
|
{
|
|
"field-name": "set",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "nun" }
|
|
}
|
|
]
|
|
}
|
|
schema: confirm index was not created because field failed
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "create",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "set",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
}
|
|
]
|
|
}
|
|
schema-error: can't recreate index
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "create",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "newfield",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
}
|
|
]
|
|
}
|
|
schema: can add field to existing index
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "ensure",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "newfield",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
}
|
|
]
|
|
}
|
|
schema-error: second field failing in existing index
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "ensure",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "addokay",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
},
|
|
{
|
|
"field-name": "addfail",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "nun" }
|
|
}
|
|
]
|
|
}
|
|
schema: verify that fields we think exist do exist
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "require",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "newfield",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
}
|
|
]
|
|
}
|
|
schema-error: successful field deleted anyway because second field failed
|
|
{
|
|
"index-name": "examplekeys",
|
|
"index-action": "require",
|
|
"primary-key-type": "string",
|
|
"fields": [
|
|
{
|
|
"field-name": "addokay",
|
|
"field-type": "id",
|
|
"field-options": { "cache-type": "none" }
|
|
}
|
|
]
|
|
}
|