Skip to content

Commit e7a16ac

Browse files
committed
add tests
1 parent 7e296a2 commit e7a16ac

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

tests/functional/adapter/test_seed.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import os
2+
13
import pytest
24
from dbt.tests.adapter.simple_seed.seeds import seeds__expected_sql
5+
from dbt.tests.adapter.simple_seed.test_seed import SeedConfigBase
36
from dbt.tests.adapter.simple_seed.test_seed import TestBasicSeedTests as BaseBasicSeedTests
47
from dbt.tests.adapter.simple_seed.test_seed import (
58
TestSeedConfigFullRefreshOff as BaseSeedConfigFullRefreshOff,
@@ -20,7 +23,7 @@
2023
seeds__disabled_in_config_csv,
2124
seeds__enabled_in_config_csv,
2225
)
23-
from dbt.tests.util import get_connection
26+
from dbt.tests.util import get_connection, run_dbt
2427

2528
from dbt.adapters.sqlserver import SQLServerAdapter
2629

@@ -180,3 +183,43 @@ def setUp(self, project):
180183

181184
class TestSeedSpecificFormatsSQLServer(BaseSeedSpecificFormats):
182185
pass
186+
187+
188+
class TestSeedBatchSizeMaxSQLServer(SeedConfigBase):
189+
@pytest.fixture(scope="class")
190+
def seeds(self, test_data_dir):
191+
return {
192+
"five_columns.csv": """
193+
seed_id,first_name,email,ip_address,birthday
194+
1,Larry,[email protected],69.135.206.194,2008-09-12 19:08:31
195+
2,Larry,[email protected],64.210.133.162,1978-05-09 04:15:14
196+
3,Anna,[email protected],168.104.64.114,2011-10-16 04:07:57
197+
"""
198+
}
199+
200+
def test_max_batch_size(self, project, logs_dir):
201+
run_dbt(["seed"])
202+
with open(os.path.join(logs_dir, "dbt.log"), "r") as fp:
203+
logs = "".join(fp.readlines())
204+
205+
assert "Inserting batches of 400 records" in logs
206+
207+
208+
class TestSeedBatchSizeCustomSQLServer(SeedConfigBase):
209+
@pytest.fixture(scope="class")
210+
def seeds(self, test_data_dir):
211+
return {
212+
"six_columns.csv": """
213+
seed_id,first_name,last_name,email,ip_address,birthday
214+
1,Larry,King,[email protected],69.135.206.194,2008-09-12 19:08:31
215+
2,Larry,Perkins,[email protected],64.210.133.162,1978-05-09 04:15:14
216+
3,Anna,Montgomery,[email protected],168.104.64.114,2011-10-16 04:07:57
217+
"""
218+
}
219+
220+
def test_custom_batch_size(self, project, logs_dir):
221+
run_dbt(["seed"])
222+
with open(os.path.join(logs_dir, "dbt.log"), "r") as fp:
223+
logs = "".join(fp.readlines())
224+
225+
assert "Inserting batches of 350 records" in logs

0 commit comments

Comments
 (0)