mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
Revert "Add docker for integration tests" (#36)
This reverts commit 67d938c3de
.
This commit is contained in:
parent
67d938c3de
commit
5980a0a845
@ -1 +0,0 @@
|
|||||||
target/
|
|
@ -20,6 +20,15 @@ jobs:
|
|||||||
- script: cargo fmt --all -- --check
|
- script: cargo fmt --all -- --check
|
||||||
displayName: Run Rustfmt
|
displayName: Run Rustfmt
|
||||||
|
|
||||||
|
- job: "Bench"
|
||||||
|
pool:
|
||||||
|
vmImage: "ubuntu-16.04"
|
||||||
|
container: "rust:latest"
|
||||||
|
condition: eq(variables['Build.Reason'], 'PullRequest')
|
||||||
|
steps:
|
||||||
|
- script: cargo bench
|
||||||
|
displayName: Run benchmark
|
||||||
|
|
||||||
- job: "Test"
|
- job: "Test"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -41,9 +50,6 @@ jobs:
|
|||||||
pool:
|
pool:
|
||||||
vmImage: "ubuntu-16.04"
|
vmImage: "ubuntu-16.04"
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
|
||||||
inputs:
|
|
||||||
versionSpec: '12.0.0'
|
|
||||||
- script: |
|
- script: |
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
|
||||||
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
|
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
|
||||||
@ -57,5 +63,6 @@ jobs:
|
|||||||
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
||||||
- script: cargo build --all
|
- script: cargo build --all
|
||||||
displayName: Cargo build
|
displayName: Cargo build
|
||||||
- script: cargo test -- --ignored
|
# Until env stubbing is solved, make tests run on a single thread
|
||||||
|
- script: cargo test --all -- --test-threads=1
|
||||||
displayName: Cargo test
|
displayName: Cargo test
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if ! (docker --version); then
|
|
||||||
printf 'Docker is required to run the starship integration tests.\n'
|
|
||||||
printf 'Please download and install Docker in order to run these tests locally.\n'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf 'Building test docker image:\n'
|
|
||||||
docker build -f tests/Dockerfile --tag starship-test .
|
|
||||||
|
|
||||||
printf 'Running test suite:\n'
|
|
||||||
docker run --rm -t -v $(pwd):/starship starship-test
|
|
@ -1,36 +0,0 @@
|
|||||||
FROM rust:latest
|
|
||||||
|
|
||||||
# Install Node.js
|
|
||||||
ENV NODE_VERSION 12.0.0
|
|
||||||
RUN curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \
|
|
||||||
&& . $HOME/.nvm/nvm.sh \
|
|
||||||
&& nvm install $NODE_VERSION \
|
|
||||||
&& nvm alias default $NODE_VERSION \
|
|
||||||
&& nvm use default
|
|
||||||
ENV PATH /root/.nvm/versions/node/v$NODE_VERSION/bin:$PATH
|
|
||||||
# Check that Node.js was correctly installed
|
|
||||||
RUN node --version
|
|
||||||
|
|
||||||
# Create blank project
|
|
||||||
RUN USER=root cargo new --bin starship
|
|
||||||
WORKDIR /starship
|
|
||||||
|
|
||||||
# We want dependencies cached, so copy those first
|
|
||||||
COPY ./Cargo.lock ./Cargo.lock
|
|
||||||
COPY ./Cargo.toml ./Cargo.toml
|
|
||||||
|
|
||||||
# Cargo.toml will fail to parse without my_benchmark
|
|
||||||
RUN mkdir benches
|
|
||||||
RUN touch benches/my_benchmark.rs
|
|
||||||
|
|
||||||
# This is a dummy build to get dependencies cached
|
|
||||||
RUN cargo build --release
|
|
||||||
|
|
||||||
# Delete the dummy build
|
|
||||||
RUN rm -rf /starship
|
|
||||||
|
|
||||||
# Create the directory for the real source files
|
|
||||||
RUN mkdir starship
|
|
||||||
WORKDIR /starship
|
|
||||||
|
|
||||||
CMD [ "cargo", "test", "--", "--ignored"]
|
|
@ -1,5 +1,4 @@
|
|||||||
use ansi_term::Color;
|
use ansi_term::Color;
|
||||||
use dirs::home_dir;
|
|
||||||
use git2::Repository;
|
use git2::Repository;
|
||||||
use starship::segment::Segment;
|
use starship::segment::Segment;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
@ -26,8 +25,7 @@ fn home_directory() -> io::Result<()> {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn directory_in_home() -> io::Result<()> {
|
fn directory_in_home() -> io::Result<()> {
|
||||||
let dir = home_dir().unwrap().join("starship/engine");
|
let dir = Path::new("~/starship/engine");
|
||||||
fs::create_dir_all(&dir)?;
|
|
||||||
|
|
||||||
let expected = Segment::new("dir")
|
let expected = Segment::new("dir")
|
||||||
.set_value("~/starship/engine")
|
.set_value("~/starship/engine")
|
||||||
@ -42,8 +40,7 @@ fn directory_in_home() -> io::Result<()> {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn truncated_directory_in_home() -> io::Result<()> {
|
fn truncated_directory_in_home() -> io::Result<()> {
|
||||||
let dir = home_dir().unwrap().join("starship/engine/schematics");
|
let dir = Path::new("~/starship/engine/schematics");
|
||||||
fs::create_dir_all(&dir)?;
|
|
||||||
|
|
||||||
let expected = Segment::new("dir")
|
let expected = Segment::new("dir")
|
||||||
.set_value("starship/engine/schematics")
|
.set_value("starship/engine/schematics")
|
||||||
@ -70,11 +67,12 @@ fn root_directory() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[ignore]
|
||||||
fn directory_in_root() -> io::Result<()> {
|
fn directory_in_root() -> io::Result<()> {
|
||||||
let dir = Path::new("/opt");
|
let dir = Path::new("/private");
|
||||||
|
|
||||||
let expected = Segment::new("dir")
|
let expected = Segment::new("dir")
|
||||||
.set_value("/opt")
|
.set_value("/private")
|
||||||
.set_style(Color::Cyan.bold())
|
.set_style(Color::Cyan.bold())
|
||||||
.output();
|
.output();
|
||||||
let actual = common::render_segment("dir", &dir);
|
let actual = common::render_segment("dir", &dir);
|
||||||
@ -86,11 +84,10 @@ fn directory_in_root() -> io::Result<()> {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
#[ignore]
|
||||||
fn truncated_directory_in_root() -> io::Result<()> {
|
fn truncated_directory_in_root() -> io::Result<()> {
|
||||||
let dir = Path::new("/opt/starship/thrusters/rocket");
|
let dir = Path::new("/private/var/folders/3s");
|
||||||
fs::create_dir_all(&dir)?;
|
|
||||||
|
|
||||||
let expected = Segment::new("dir")
|
let expected = Segment::new("dir")
|
||||||
.set_value("starship/thrusters/rocket")
|
.set_value("var/folders/3s")
|
||||||
.set_style(Color::Cyan.bold())
|
.set_style(Color::Cyan.bold())
|
||||||
.output();
|
.output();
|
||||||
let actual = common::render_segment("dir", &dir);
|
let actual = common::render_segment("dir", &dir);
|
||||||
@ -100,7 +97,6 @@ fn truncated_directory_in_root() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
|
||||||
fn git_repo_root() -> io::Result<()> {
|
fn git_repo_root() -> io::Result<()> {
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let repo_dir = tmp_dir.path().join("rocket-controls");
|
let repo_dir = tmp_dir.path().join("rocket-controls");
|
||||||
@ -119,7 +115,6 @@ fn git_repo_root() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
|
||||||
fn directory_in_git_repo() -> io::Result<()> {
|
fn directory_in_git_repo() -> io::Result<()> {
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let repo_dir = tmp_dir.path().join("rocket-controls");
|
let repo_dir = tmp_dir.path().join("rocket-controls");
|
||||||
@ -139,7 +134,6 @@ fn directory_in_git_repo() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore]
|
|
||||||
fn truncated_directory_in_git_repo() -> io::Result<()> {
|
fn truncated_directory_in_git_repo() -> io::Result<()> {
|
||||||
let tmp_dir = TempDir::new()?;
|
let tmp_dir = TempDir::new()?;
|
||||||
let repo_dir = tmp_dir.path().join("rocket-controls");
|
let repo_dir = tmp_dir.path().join("rocket-controls");
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
use ansi_term::Color;
|
|
||||||
use starship::segment::Segment;
|
|
||||||
use std::fs::{self, File};
|
|
||||||
use std::io;
|
|
||||||
use tempfile::TempDir;
|
|
||||||
|
|
||||||
mod common;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[ignore]
|
|
||||||
fn folder_with_package_json() -> io::Result<()> {
|
|
||||||
let dir = TempDir::new()?;
|
|
||||||
File::create(dir.path().join("package.json"))?;
|
|
||||||
|
|
||||||
let expected = Segment::new("node")
|
|
||||||
.set_value("⬢ v12.0.0")
|
|
||||||
.set_style(Color::Green)
|
|
||||||
.output();
|
|
||||||
let actual = common::render_segment("nodejs", &dir.path());
|
|
||||||
assert_eq!(expected, actual);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[ignore]
|
|
||||||
fn folder_with_js_file() -> io::Result<()> {
|
|
||||||
let dir = TempDir::new()?;
|
|
||||||
File::create(dir.path().join("index.js"))?;
|
|
||||||
|
|
||||||
let expected = Segment::new("node")
|
|
||||||
.set_value("⬢ v12.0.0")
|
|
||||||
.set_style(Color::Green)
|
|
||||||
.output();
|
|
||||||
let actual = common::render_segment("nodejs", &dir.path());
|
|
||||||
assert_eq!(expected, actual);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
#[ignore]
|
|
||||||
fn folder_with_node_modules() -> io::Result<()> {
|
|
||||||
let dir = TempDir::new()?;
|
|
||||||
let node_modules = dir.path().join("node_modules");
|
|
||||||
fs::create_dir_all(&node_modules)?;
|
|
||||||
|
|
||||||
let expected = Segment::new("node")
|
|
||||||
.set_value("⬢ v12.0.0")
|
|
||||||
.set_style(Color::Green)
|
|
||||||
.output();
|
|
||||||
let actual = common::render_segment("nodejs", &dir.path());
|
|
||||||
assert_eq!(expected, actual);
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user