msbuild - MSTests fail on build server after passing locally -
this bit odd me, i've worked through several micro-services unit tests , haven't experienced problem this. issue unit tests pass locally some fail on our build server. oddity if single out failing test in build script pass. if run test running before failure result. if remote test server , access test result file , rerun tests, pass. me says has build environment - "runner" context. specific error on failed tests is:
system.data.entity.core.entityexception: underlying provider failed on open. ---> system.data.sqlclient.sqlexception: network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections.
again, test had ran , passed accessing db right before failing test. additionally should noted these tests using stored procedures access data , using linq sql (.dbml). thought had context not being disposed of after several iterations of idisposable implementation , peppering using statements throughout data access code think have ruled out. went far rip out .dbml reference , new entity model (.edmx) ended getting same results end, after simplification of problem. can reproduce issue 2 unit tests now, 1 pass, 1 fail. when ran separately both pass, when ran manually either locally or on build server both pass.
dev server
we have our dev environment setup remote server. devs use vs 2013 ultimate. devs use shared instance of localdb. seems working fine, able develop , test against environment. tests pass here solution in question. push code upstream build server.
build server
this windows 2012 server gitlabs installed, every commit our dev branches run build via .gitlab-ci.yml build script. part simple msbuild -> mstest calls, nothing fancy. server has own shared instance of localdb running matching schemas dev environment. several other repositories have passing builds/unit tests utilizing setup. connection strings accessing data using integrated security, , gitlab runner service account has full privs localdb. thing can identify notably different solution in question heavy use of sprocs, saying of these unit tests pass , all using sprocs. mentioned, after build fails if manually go in , access test results file , manually invoke tests on build server pass.
so i'm not sure going on here, has experienced sort of behavior before? if so, how did solve it? i'd these tests passing build can pass , move on.
ok have got unit tests pass weird thing ended doing them pass , i'm not quite sure why worked. though runners account had full "server role" privs on localdb instance (all boxes checked) decided throw hail marry , went through process of "mapping" user db in question, setting default schema dbo , giving him full privs (all boxes checked). after operation...the tests pass. i'm not understanding way permissions propagated in localdb, under assumption server role of god-like imply full privs individual dbs guess not? i'm no dba, i'm going chat our dba , see thinks. perhaps has sproc execution? maybe requires special privs? know in passed i've had create special roles execute sprocs, bit finicky. anyways, unit tests pass i'm happy now!
Comments
Post a Comment