@@ -30,22 +30,22 @@ class WarehouseLambda
3030 "type" => "Widget" ,
3131 "id" => "1" ,
3232 "version" => 3 ,
33- "json_schema_version" => 1 ,
33+ JSON_SCHEMA_VERSION_KEY => 1 ,
3434 "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" }
3535 } )
3636 end
3737
3838 it "writes operations to S3 as gzipped JSONL files and returns success results" do
39- op1 = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , "json_schema_version" => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
40- op2 = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "2" , "version" => 5 , "json_schema_version" => 2 , "record" => { "id" => "2" , "dayOfWeek" => "TUE" , "created_at" => "2024-09-15T13:30:12Z" , "workspace_id" => "ws-2" } } )
39+ op1 = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , JSON_SCHEMA_VERSION_KEY => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
40+ op2 = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "2" , "version" => 5 , JSON_SCHEMA_VERSION_KEY => 2 , "record" => { "id" => "2" , "dayOfWeek" => "TUE" , "created_at" => "2024-09-15T13:30:12Z" , "workspace_id" => "ws-2" } } )
4141 operations = [ op1 , op2 ]
4242
4343 results = warehouse_dumper . bulk ( operations )
4444
45- # Verify S3 uploads - should have 2 files (one for json_schema_version 1, one for json_schema_version 2)
45+ # Verify S3 uploads - should have 2 files (one for json schema version 1, one for json schema version 2)
4646 expect ( s3_client . api_requests . map { |req | req [ :operation_name ] } ) . to eq [ :put_object , :put_object ]
4747
48- # Verify first file (json_schema_version 1)
48+ # Verify first file (json schema version 1)
4949 params1 = s3_client . api_requests [ 0 ] . fetch ( :params )
5050 expect ( params1 [ :bucket ] ) . to eq s3_bucket_name
5151 expect ( params1 [ :key ] ) . to match %r{Data0001/Widget/v1/2024-09-15/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\. jsonl\. gz}
@@ -61,7 +61,7 @@ class WarehouseLambda
6161 lines1 = jsonl_content1 . split ( "\n " )
6262 expect ( lines1 . size ) . to eq 1
6363
64- # Verify second file (json_schema_version 2)
64+ # Verify second file (json schema version 2)
6565 params2 = s3_client . api_requests [ 1 ] . fetch ( :params )
6666 expect ( params2 [ :key ] ) . to match %r{Data0001/Widget/v2/2024-09-15/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\. jsonl\. gz}
6767
@@ -99,8 +99,8 @@ class WarehouseLambda
9999 end
100100
101101 it "writes operations of different types to separate S3 files" do
102- widget_op = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , "json_schema_version" => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
103- component_op = new_primary_indexing_operation ( { "type" => "Component" , "id" => "c1" , "version" => 2 , "json_schema_version" => 1 , "record" => { "id" => "c1" , "created_at" => "2024-09-15T12:30:12Z" } } )
102+ widget_op = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , JSON_SCHEMA_VERSION_KEY => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
103+ component_op = new_primary_indexing_operation ( { "type" => "Component" , "id" => "c1" , "version" => 2 , JSON_SCHEMA_VERSION_KEY => 1 , "record" => { "id" => "c1" , "created_at" => "2024-09-15T12:30:12Z" } } )
104104 operations = [ widget_op , component_op ]
105105
106106 warehouse_dumper . bulk ( operations )
@@ -113,8 +113,8 @@ class WarehouseLambda
113113 end
114114
115115 it "logs structured information about received batch and dumped files" do
116- widget_op = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , "json_schema_version" => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
117- component_op = new_primary_indexing_operation ( { "type" => "Component" , "id" => "c1" , "version" => 2 , "json_schema_version" => 1 , "record" => { "id" => "c1" , "created_at" => "2024-09-15T12:30:12Z" } } )
116+ widget_op = new_primary_indexing_operation ( { "type" => "Widget" , "id" => "1" , "version" => 3 , JSON_SCHEMA_VERSION_KEY => 1 , "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" } } )
117+ component_op = new_primary_indexing_operation ( { "type" => "Component" , "id" => "c1" , "version" => 2 , JSON_SCHEMA_VERSION_KEY => 1 , "record" => { "id" => "c1" , "created_at" => "2024-09-15T12:30:12Z" } } )
118118 operations = [ widget_op , component_op ]
119119
120120 warehouse_dumper . bulk ( operations )
@@ -127,13 +127,13 @@ class WarehouseLambda
127127 a_hash_including ( {
128128 "s3_bucket" => s3_bucket_name ,
129129 "type" => "Widget" ,
130- "json_schema_version" => 1 ,
130+ JSON_SCHEMA_VERSION_KEY => 1 ,
131131 "record_count" => 1
132132 } ) ,
133133 a_hash_including ( {
134134 "s3_bucket" => s3_bucket_name ,
135135 "type" => "Component" ,
136- "json_schema_version" => 1 ,
136+ JSON_SCHEMA_VERSION_KEY => 1 ,
137137 "record_count" => 1
138138 } )
139139 ]
@@ -183,7 +183,7 @@ class WarehouseLambda
183183 "type" => "Widget" ,
184184 "id" => "1" ,
185185 "version" => 3 ,
186- "json_schema_version" => 1 ,
186+ JSON_SCHEMA_VERSION_KEY => 1 ,
187187 "record" => { "id" => "1" , "dayOfWeek" => "MON" , "created_at" => "2024-09-15T12:30:12Z" , "workspace_id" => "ws-1" }
188188 } )
189189
0 commit comments