-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unit tests err: The user, group or application #11294
Comments
PLUS+++ |
Hello! @IDONTSUDO (and @kostia7alania) I'll be doing my best to help you. My first guess is that this seems to be an issue with the environment variables. With the parameters you've sent, it isn't clear to me how things are working together. I'll first write about what I don't understand from your issue, then I'll provide a next step that you can try, just in case it helps us find a quick solution, then I'll provide a code scenario that should work, so that you can try with something more narrowly defined first. What I don't understand from the issue:
This is what I'm reading: import { SQLClient, SQLPool, SQLConnectionConfig, getEnv } from '../exports'; // this will be your custom import
import { expect } from 'chai';
import { ConnectionConfig } from 'tedious';
describe('Options tests', () => {
/**@problem Готовим тестовое SQL подключение;
*/
it('checking default options', async (done) => {
let _SQL_JETTI_SM_POOL: SQLPool
const sqlConnString = await getEnv('SQL-CONN-SM');
const sqlConn: SQLConnectionConfig = JSON.parse(sqlConnString);
_SQL_JETTI_SM_POOL = new SQLPool(sqlConn);
console.log(_SQL_JETTI_SM_POOL)
done()
});
}); Where are you using the Azure clients? What am I missing? Any help is appreciated. What you can try right now:
A sample that should work: While The
Assuming we have the environment variables ready, let's write a code snippet using both Let's copy the following code snippet in a new file, in a new folder. We can call this file const { SecretClient } = require("@azure/keyvault-secrets");
const { EnvironmentCredential } = require("@azure/identity");
async function main() {
const credential = new EnvironmentCredential();
const client = new SecretClient("<keyvault-url>", credential);
const secretName = "top-secret";
const result = await client.setSecret(secretName, "top-secret-value");
console.log("result: ", result);
const secret = await client.getSecret(secretName);
console.log("secret: ", secret);
}
main().catch((err) => {
console.log("error code: ", err.code);
console.log("error message: ", err.message);
console.log("error stack: ", err.stack);
});
Once that file is created, in a new folder, make sure to add a Since you're in Ubuntu, you should be able to run the code above with something like the following command:
If this fails, please apply the following change to review your environment variables: + console.log({
+ AZURE_CLIENT_ID: process.env.AZURE_CLIENT_ID,
+ AZURE_TENANT_ID: process.env.AZURE_TENANT_ID,
+ AZURE_CLIENT_SECRET: process.env.AZURE_CLIENT_SECRET,
+ });
async function main() {
It's worth noting that this previous sample shows that we should be able to read the process.env variables as expected, meaning that what we send is what we should see, independently of the rest of the script. See that we would be logging them before we even define the Does this help? Thank you for your time! We appreciate your interest in using our clients. I'll be ready to answer any reply. |
thx! |
@IDONTSUDO (and @kostia7alania), and others, Come back anytime! We'll be here, ready to help! 👍 |
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
Adding Force Deletion Query Parameter for Resource Group Delete (Azure#11294) * Adding Force Deletion Types Query Parameter for Resource Group Delete (and a corresponding VM type example) * Add newline in Force Delete VM example JSON
@azure/keyvault-secrets, @azure/identity
Package Version:
@azure/identity: ^1.1.0,
@azure/keyvault-secrets: ^4.1.0
Operating system: Linux/Ubuntu 20
[ yes] typescript
Describe the bug
I want to write some unit tests using mocha.
script to run.
console output:
My code.
I want to test code that tied to "@azure/identity", "@azure/keyvault-secrets".
In general, as I understand it, the problem is that I do not run this test through the func start command. And func start at start complements process.env part of the authorization information is taken from there. Could you help me and indicate what this information is?
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: