<commit_before>---
# file: roles/go/tests/tasks
#
# Test tasks to verify role execution.
#

- name: include OS family/distribution specific test variables
  include_vars: "{{ item }}"
  with_first_found:
    - "../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
    - "../vars/{{ ansible_distribution | lower }}.yml"
    - "../vars/{{ ansible_os_family | lower }}.yml"

- name: is go_installed fact set?
  fail:
    msg="go_installed fact is not defined!"
  when: not go_installed is defined

- name: is go_installed fact true?
  fail:
    msg="go_installed fact is false!"
  when: not go_installed

- name: is go_version_installed fact set?
  fail:
    msg="go_installed fact is not defined!"
  when: not go_version_installed is defined

- name: is go_version_installed value correct?
  fail:
    msg="go_version_installed value is {{ go_version_installed }} instead of {{ expected_go_version }}!"
  when: go_version_installed != expected_go_version

- name: register result_go_version with host installed Go version
  shell: "go version | awk '{ print $3 }' | cut -c 3- "
  register: result_go_version
  environment:
    GOPATH: "{{ go_path }}"
  changed_when: no

- name: is installed Go version correct?
  fail:
    msg="version output was {{ result_go_version.stdout }} instead of {{ expected_go_version }}"
  when: result_go_version.stdout != expected_go_version<commit_msg>added debug statements.<commit_after>---
# file: roles/go/tests/tasks
#
# Test tasks to verify role execution.
#

- name: include OS family/distribution specific test variables
  include_vars: "{{ item }}"
  with_first_found:
    - "../vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
    - "../vars/{{ ansible_distribution | lower }}.yml"
    - "../vars/{{ ansible_os_family | lower }}.yml"

- name: is go_installed fact set?
  fail:
    msg="go_installed fact is not defined!"
  when: not go_installed is defined

- name: is go_installed fact true?
  fail:
    msg="go_installed fact is false!"
  when: not go_installed

- name: is go_version_installed fact set?
  fail:
    msg="go_installed fact is not defined!"
  when: not go_version_installed is defined

- name: is go_version_installed value correct?
  fail:
    msg="go_version_installed value is {{ go_version_installed }} instead of {{ expected_go_version }}!"
  when: go_version_installed != expected_go_version

- name: debug Go environment
  shell: "go env"
  register: result_go_env
  environment:
    GOROOT: "/usr/lib/go"
  changed_when: no
  tags:
    - debug

- debug:
    var=result_go_env
  tags:
    - debug

- name: register result_go_version with host installed Go version
  shell: "go version | awk '{ print $3 }' | cut -c 3- "
  register: result_go_version
  environment:
    GOPATH: "{{ go_path }}"
    GOROOT: "/usr/lib/go"
  changed_when: no

- name: is installed Go version correct?
  fail:
    msg="version output was {{ result_go_version.stdout }} instead of {{ expected_go_version }}"
  when: result_go_version.stdout != expected_go_version
{'fraction_non_alphanumeric': 0.1135626216742375, 'fraction_numerical': 0.0012978585334198572, 'mean_word_length': 3.7872670807453415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3370997', 'n_tokens_mistral': 1007, 'n_tokens_neox': 964, 'n_words': 293}