Skip to content
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

meta: run smoke tests in CI #17230

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ jobs:
run: yarn sscce-sqlite3
- name: Integration tests (sqlite3)
run: yarn lerna run test-integration-sqlite3 --scope=@sequelize/core
- name: Smoke Tests
run: yarn cross-env DIALECT=sqlite3 yarn lerna run test-smoke --scope=@sequelize/core
docs:
name: Generate TypeDoc
runs-on: ubuntu-latest
Expand Down Expand Up @@ -196,6 +198,8 @@ jobs:
run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
- name: Smoke Tests
run: yarn lerna run test-smoke --scope=@sequelize/core
test-postgres:
strategy:
fail-fast: false
Expand Down Expand Up @@ -227,6 +231,8 @@ jobs:
- run: yarn start-postgres-${{ matrix.postgres-version }}
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
- name: Smoke Tests
run: yarn lerna run test-smoke --scope=@sequelize/core
test-oldest-latest:
strategy:
fail-fast: false
Expand All @@ -253,6 +259,8 @@ jobs:
- run: yarn start-${{ matrix.dialect }}-${{ matrix.database-version }}
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
- name: Smoke Tests
run: yarn lerna run test-smoke --scope=@sequelize/core
release:
name: Release
runs-on: ubuntu-latest
Expand Down
95 changes: 45 additions & 50 deletions packages/core/test/smoke/smoketests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe(Support.getTestDialectTeaser('Smoke Tests'), () => {
it('gets all associated objects with all fields', async function () {
const john = await this.User.findOne({ where: { username: 'John' } });
const tasks = await john.getTasks();
for (const attr of Object.keys(tasks[0].getAttributes())) {
expect(tasks[0]).to.have.property(attr);
for (const attributeName of this.Task.modelDefinition.attributes.keys()) {
expect(tasks[0]).to.have.property(attributeName);
}
});

Expand Down Expand Up @@ -108,14 +108,18 @@ describe(Support.getTestDialectTeaser('Smoke Tests'), () => {
indexes: [
{
unique: true,
fields: ['UserUserSecondId', 'GroupGroupSecondId'],
fields: ['userUserSecondId', 'groupGroupSecondId'],
name: 'UserHasGroup_Second_Unique',
},
],
},
);

User.belongsToMany(Group, { through: User_has_Group, sourceKey: 'userSecondId' });
Group.belongsToMany(User, { through: User_has_Group, sourceKey: 'groupSecondId' });
User.belongsToMany(Group, {
through: User_has_Group,
sourceKey: 'userSecondId',
targetKey: 'groupSecondId',
});

await this.sequelize.sync({ force: true });
const [user1, user2, group1, group2] = await Promise.all([
Expand All @@ -137,92 +141,92 @@ describe(Support.getTestDialectTeaser('Smoke Tests'), () => {
]);

expect(users.length).to.equal(2);
expect(users[0].Groups.length).to.equal(1);
expect(users[1].Groups.length).to.equal(1);
expect(users[0].Groups[0].User_has_Group.UserUserSecondId).to.be.ok;
expect(users[0].groups.length).to.equal(1);
expect(users[1].groups.length).to.equal(1);
expect(users[0].groups[0].User_has_Group.userUserSecondId).to.be.ok;
if (dialect === 'db2') {
expect(users[0].Groups[0].User_has_Group.UserUserSecondId).to.deep.equal(
expect(users[0].groups[0].User_has_Group.userUserSecondId).to.deep.equal(
users[0].userSecondId,
);
} else {
expect(users[0].Groups[0].User_has_Group.UserUserSecondId).to.equal(users[0].userSecondId);
expect(users[0].groups[0].User_has_Group.userUserSecondId).to.equal(users[0].userSecondId);
}

expect(users[0].Groups[0].User_has_Group.GroupGroupSecondId).to.be.ok;
expect(users[0].groups[0].User_has_Group.groupGroupSecondId).to.be.ok;
if (dialect === 'db2') {
expect(users[0].Groups[0].User_has_Group.GroupGroupSecondId).to.deep.equal(
users[0].Groups[0].groupSecondId,
expect(users[0].groups[0].User_has_Group.groupGroupSecondId).to.deep.equal(
users[0].groups[0].groupSecondId,
);
} else {
expect(users[0].Groups[0].User_has_Group.GroupGroupSecondId).to.equal(
users[0].Groups[0].groupSecondId,
expect(users[0].groups[0].User_has_Group.groupGroupSecondId).to.equal(
users[0].groups[0].groupSecondId,
);
}

expect(users[1].Groups[0].User_has_Group.UserUserSecondId).to.be.ok;
expect(users[1].groups[0].User_has_Group.userUserSecondId).to.be.ok;
if (dialect === 'db2') {
expect(users[1].Groups[0].User_has_Group.UserUserSecondId).to.deep.equal(
expect(users[1].groups[0].User_has_Group.userUserSecondId).to.deep.equal(
users[1].userSecondId,
);
} else {
expect(users[1].Groups[0].User_has_Group.UserUserSecondId).to.equal(users[1].userSecondId);
expect(users[1].groups[0].User_has_Group.userUserSecondId).to.equal(users[1].userSecondId);
}

expect(users[1].Groups[0].User_has_Group.GroupGroupSecondId).to.be.ok;
expect(users[1].groups[0].User_has_Group.groupGroupSecondId).to.be.ok;
if (dialect === 'db2') {
expect(users[1].Groups[0].User_has_Group.GroupGroupSecondId).to.deep.equal(
users[1].Groups[0].groupSecondId,
expect(users[1].groups[0].User_has_Group.groupGroupSecondId).to.deep.equal(
users[1].groups[0].groupSecondId,
);
} else {
expect(users[1].Groups[0].User_has_Group.GroupGroupSecondId).to.equal(
users[1].Groups[0].groupSecondId,
expect(users[1].groups[0].User_has_Group.groupGroupSecondId).to.equal(
users[1].groups[0].groupSecondId,
);
}

expect(groups.length).to.equal(2);
expect(groups[0].Users.length).to.equal(1);
expect(groups[1].Users.length).to.equal(1);
expect(groups[0].Users[0].User_has_Group.GroupGroupSecondId).to.be.ok;
expect(groups[0].users.length).to.equal(1);
expect(groups[1].users.length).to.equal(1);
expect(groups[0].users[0].User_has_Group.groupGroupSecondId).to.be.ok;
if (dialect === 'db2') {
expect(groups[0].Users[0].User_has_Group.GroupGroupSecondId).to.deep.equal(
expect(groups[0].users[0].User_has_Group.groupGroupSecondId).to.deep.equal(
groups[0].groupSecondId,
);
} else {
expect(groups[0].Users[0].User_has_Group.GroupGroupSecondId).to.equal(
expect(groups[0].users[0].User_has_Group.groupGroupSecondId).to.equal(
groups[0].groupSecondId,
);
}

expect(groups[0].Users[0].User_has_Group.UserUserSecondId).to.be.ok;
expect(groups[0].users[0].User_has_Group.userUserSecondId).to.be.ok;
if (dialect === 'db2') {
expect(groups[0].Users[0].User_has_Group.UserUserSecondId).to.deep.equal(
groups[0].Users[0].userSecondId,
expect(groups[0].users[0].User_has_Group.userUserSecondId).to.deep.equal(
groups[0].users[0].userSecondId,
);
} else {
expect(groups[0].Users[0].User_has_Group.UserUserSecondId).to.equal(
groups[0].Users[0].userSecondId,
expect(groups[0].users[0].User_has_Group.userUserSecondId).to.equal(
groups[0].users[0].userSecondId,
);
}

expect(groups[1].Users[0].User_has_Group.GroupGroupSecondId).to.be.ok;
expect(groups[1].users[0].User_has_Group.groupGroupSecondId).to.be.ok;
if (dialect === 'db2') {
expect(groups[1].Users[0].User_has_Group.GroupGroupSecondId).to.deep.equal(
expect(groups[1].users[0].User_has_Group.groupGroupSecondId).to.deep.equal(
groups[1].groupSecondId,
);
} else {
expect(groups[1].Users[0].User_has_Group.GroupGroupSecondId).to.equal(
expect(groups[1].users[0].User_has_Group.groupGroupSecondId).to.equal(
groups[1].groupSecondId,
);
}

expect(groups[1].Users[0].User_has_Group.UserUserSecondId).to.be.ok;
expect(groups[1].users[0].User_has_Group.userUserSecondId).to.be.ok;
if (dialect === 'db2') {
expect(groups[1].Users[0].User_has_Group.UserUserSecondId).to.deep.equal(
groups[1].Users[0].userSecondId,
expect(groups[1].users[0].User_has_Group.userUserSecondId).to.deep.equal(
groups[1].users[0].userSecondId,
);
} else {
expect(groups[1].Users[0].User_has_Group.UserUserSecondId).to.equal(
groups[1].Users[0].userSecondId,
expect(groups[1].users[0].User_has_Group.userUserSecondId).to.equal(
groups[1].users[0].userSecondId,
);
}
});
Expand Down Expand Up @@ -359,7 +363,6 @@ describe(Support.getTestDialectTeaser('Smoke Tests'), () => {
beforeEach(function () {
this.B.belongsTo(this.A, { as: 'relation1' });
this.A.belongsToMany(this.B, { as: 'relation2', through: 'AB' });
this.B.belongsToMany(this.A, { as: 'relation2', through: 'AB' });

return this.sequelize.sync({ force: true });
});
Expand Down Expand Up @@ -456,14 +459,6 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
});

describe(Support.getTestDialectTeaser('Model'), () => {
before(function () {
this.clock = sinon.useFakeTimers();
});

after(function () {
this.clock.restore();
});

beforeEach(async function () {
this.User = this.sequelize.define('User', {
username: DataTypes.STRING,
Expand Down