Skip to content

Add functionality to FakeTable synonyms for remote tables/views #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

dkultasev
Copy link
Collaborator

@dkultasev dkultasev commented Oct 4, 2019

The main idea of this functionality is to create views/wrappers that would point to the needed database's system views and use them instead of the own ones.

Currently only faking data is working (identity columns, default constrains and computed columns also). Foreign keys and other constraints that are added with ApplyConstraint procedure are not implemented.

@dkultasev dkultasev changed the title Add remote FakeTable for remote synonyms functionality Add FakeTable for remote synonyms functionality Oct 4, 2019
@dkultasev dkultasev changed the title Add FakeTable for remote synonyms functionality Add functionality to FakeTable synonyms for remote tables/views Oct 4, 2019
@dkultasev
Copy link
Collaborator Author

@mbt1 I want to make tests to for remote synonyms testing. To make that happen I want to create the database and synonym inside the test. I can't create database within transaction, so I need to create it somehow before tests start and drop it when it finishes. Can you please suggest how to make that properly?

@dkultasev
Copy link
Collaborator Author

I've added bunch of unit tests and want to add all FakeTable tests for remote synonyms. However I still have problem with the certificate.

I needed to create database and store all needed DDL statements in the separate file as you can't create database within transaction. Do I need to clean it up after tests are finished/failed? There might be better approach.

@mbt1
Copy link
Collaborator

mbt1 commented Oct 22, 2019

There are several ways to go about it:

  1. Create the database and leave it in your system. Assume in the tests it is there and empty.
  2. Create it within the test using tSQLt.NewConnection
  3. Extend tSQLt to allow for a per-execution setup and teardown that is executed once per call of tSQLt.Run, outside of the tests' transactions.

If you think 3 is a good idea, let's talk before you implement anything.

@dkultasev
Copy link
Collaborator Author

I think that 3 is a good idea and OK to implement it, however I think that it would easier to split that into 2 steps. First I'll go with the step 1 and finish synonyms stuff, then I can do it in a proper way with the new PR.

I still have problems with local setup. I'm bad with certificates and it is always failing on the following tests:

[exec] |18|[InstallExternalAccessKeyTests].[test creates correct certificate in master]                                                       |    336|Failure|
[exec] |19|[InstallExternalAccessKeyTests].[test tSQLt can be set to EXTERNAL ACCESS after InstallExternalAccessKey executed]                 |    220|Failure|
[exec] |20|[InstallExternalAccessKeyTests].[test tSQLtExternalAccessKey install data is signed with same key as tSQLt.clr]                    |     10|Failure|

@dkultasev
Copy link
Collaborator Author

@mbt1 I've added UDDT support + copied and adjusted all FakeTable unit tests. What should I do now to finish up this request?

@dkultasev
Copy link
Collaborator Author

@mbt1 I've finally resolved the issues with certificate locally. Should I proceed with the instructions in NewRelease.doc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants